New to Kendo UI for jQueryStart a free 30-day trial

Push

methods

Appends the given items to the array and returns the new length of the array. An equivalent of Array.prototype.push. The new items are wrapped as an ObservableObject if they are complex objects.

The push method raises the change event. The action field of the event argument is set to "add". The items field of the event argument is the array that contains the appended items.

Returns:Number

—The new length of the array.

<script>
var array = new kendo.data.ObservableArray([{ name: "John Doe" }]);
var length = array.push({ name: "Jane Doe" });
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(length); // outputs "2"
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(array[1] instanceof kendo.data.ObservableObject); // outputs "true"
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(array[1].get("name")); // outputs "Jane Doe"
</script>
<script>
var array = new kendo.data.ObservableArray([ 1 ]);
var length = array.push(2, 3);
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(length); // outputs "3"
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(array[1]); // outputs "2"
</script>
Not finding the help you need?
Contact Support