change

Fires when the items of the ObservableArray change.

Event Data

e.action String

Specifies the type of change.

The possible values are:

  • "add"- Items are added to the ObservableArray.
  • "itemchange" - A field of an item changed.
  • "remove" - Items are removed from the ObservableArray.
e.index Number

The index at which items are removed or added. Set to undefined if e.action is "itemchange".

e.items Array

The items which were changed.

e.field String

The field name of an item that changed. Available only when e.action is "itemchange".

Example - subscribe to the change event

<script>
var array = new kendo.data.ObservableArray([1, 2, 3]);
array.bind("change", function(e) {
/* The result can be observed in the DevTools(F12) console of the browser. */
    console.log(e.action, e.index, e.items);
});
array.push(4, 5); // outputs "add", 3, [4, 5]
array.pop(); // outputs "remove", 4, [5]
var people = new kendo.data.ObservableArray([{ name: "John Doe" }]);
people.bind("change", function(e) {
/* The result can be observed in the DevTools(F12) console of the browser. */
    console.log(e.action, e.field, e.items[0].get("name"));
});
people[0].set("name", "Jane Doe"); // outputs "itemchange", "name", "Jane Doe"
</script>
In this article