Working with Kendo Data ObservableArray

Kendo.data.ObservableArray can be defined as below equation. It is a simple array with capability to track the changes.

image

Read more here

Kendo UI Observable String Array can be created as following

image

Array can be traversed in usual way as following. length filed returns number of elements in the array .

image

On any change in the observableArray change events gets fired. You can bind change event to array as following.

image

You can track finer level details of change as well. You can get following change information as shown in diagram

image

For example, let is push “John “in above array. We can do that as following

image

After that in change event you can get information like Add and John as following

image

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

image

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

image

And item can be removed as following

image

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.

image

We can insert an item in above created complex type observablearray as following

image

We can convert an array to JSON as following

image

You should get the output as following

image

In this way you can work with Kendo Data ObservableArray. I hope you find this post useful. Thanks for reading.

 

Advertisement

One thought on “Working with Kendo Data ObservableArray

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.