Kendo.data.ObservableArray can be defined as below equation. It is a simple array with capability to track the changes.
Kendo UI Observable String Array can be created as following
Array can be traversed in usual way as following. length filed returns number of elements in the array .
On any change in the observableArray change events gets fired. You can bind change event to array as following.
You can track finer level details of change as well. You can get following change information as shown in diagram
For example, let is push “John “in above array. We can do that as following
After that in change event you can get information like Add and John as following
Using Join method you can join all items of array into a string. For example, if you want to have a separator $ between all names, you can do that by calling simple join method on array as following
Join method takes a string input parameter.
An item can be inserted into array using the push method and can be removed using pop method. More than one item can be inserted as following
And item can be removed as following
So far we have worked with primitive type string observablearray. We can have complex type observablearray as well. We can create and traverse that as following.
We can insert an item in above created complex type observablearray as following
We can convert an array to JSON as following
You should get the output as following
In this way you can work with Kendo Data ObservableArray. I hope you find this post useful. Thanks for reading.
Follow @debug_mode
can we have type safe complex type observablearray.