Files
NativeScript/apps/tests/data/observable-array.md
Erjan Gavalji f15f283c74 Reorder test file structure to match the modules
Needed to have a nice structured cookbook dir in the docs

Includes:
Move the data-module tests under the data dir
Move the frame tests under the ui dir
Rename the dialog.md file to dialogs.md
Fix the web-view title
Add previous_url attributes to each article for SEO
Rename the style dir to styling to match the reference
Fix the frame-tests path
2016-05-05 10:43:35 +03:00

4.6 KiB

nav-title title description previous_url
observable-array How-To observable-array Examples for using observable-array /ApiReference/data/observable-array/HOW-TO

Observable Array module

Create ObservableArray from array.

Create ObservableArray from arguments.

Create ObservableArray with specific length.

Set ObservableArray length to new value.

Get item at specified index using getItem(index) method.

Set item at specified index using setItem(index, item) method.

Set item at specified index using setItem(index, item) method and observe change event data.

Use concat() method to combine ObservableArray with array.

Use join() method to convert ObservableArray to comma separated string.

Use join(separator) method to convert ObservableArray to string separated with specified separator.

Use pop() method to remove the last element.

Handle "change" event to know more info about the change after calling pop() method.

Use push() method to add single element to the array.

Handle "change" event to know more info about the change after calling push() method with single element.

Use push() method to add multiple elements to the array.

Handle "change" event to know more info about the change after calling push() method with multiple elements.

Use push() method to add multiple elements from source array to the ObservableArray.

Handle "change" event to know more info about the change after calling push() method with multiple elements from source array.

Use reverse() method to reverse the elements order of the ObservableArray.

Use shift() method to remove the first element of the array.

Handle "change" event to know more info about the change after calling shift() method.

Use slice() method to return array with all ObservableArray elements.

Use slice(star, end) method to return section of the array.

Use sort() method to sort the array.

Use sort(compareFunction) method to sort the array with your own comparing logic.

Use splice(start, deleteCount) method to delete elements in the array.

Handle "change" event to know more info about the change after calling splice(start, deleteCount) method.

Use splice(start, deleteCount, ...arguments) method to remove and insert elements in the array.

Handle "change" event to know more info about the change after calling splice(start, deleteCount, ...arguments) method.

Use unshift(item1, item2... itemN) method to insert elements from the start of the array.

Handle "change" event to know more info about the change after calling unshift(item1, item2... itemN) method.

Use indexOf(item) method to get the index of the desired item in the array.

Use indexOf(item, fromIndex) method to get the index of the desired item in the array starting from specified index.

Use lastIndexOf(item) method to get the last index of the desired item in the array.

Use lastIndexOf(item, fromIndex) method to get the last index of the desired item in the array starting from specified index.