ObservableArray, by adding new items while removing old items. Equivalent of
splicemethod raises the change event once or twice depending on the change. The
actionfield of the event argument is set to
"add"(if items are added) or
"remove(if items are removed). The
itemsfield of the event argument is the array that contains the appended items or removed items. In the above example the
changeevent will be raised two times - first because "baseball" is removed and second because "tennis" and "hockey" are added.
Array containing the removed items. The result of the
splice method is not an instance of
Index at which to start changing the array. If negative, will begin that many elements from the end.
An integer indicating the number of items to remove. If set to 0, no items are removed. In this case, you should specify at least one new item.
item1, ..., itemN (optional)
The items to add to the array. If you don't specify any items,
splice simply removes items from the array.
Example - splice array items
<script> var sports = new kendo.data.ObservableArray(["football", "basketball", "volleyball"]); var removed = sports.splice(1, 1, "tennis", "hockey"); console.log(removed); // outputs ["basketball"] console.log(sports); // outputs ["football", "tennis", "hockey", "volleyball"] </script>