This is a migrated thread and some comments may be shown as answers.

Automatic update the grid, after datasource is changed

1 Answer 372 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Almog
Top achievements
Rank 1
Almog asked on 05 Nov 2013, 11:30 PM
Hello, 
I have a datasource that is an javascript array(from json), and I attach him to my grid, until now everything is OK, I see my data on the grid :), 
but I want that every time that my datasource is changed(the array that I am attached to) will automatically update my grid, like auto bind,
for example, if I change value in a row in my javascript array, I want to see the change immediately in my grid , or if I add new row to my array, I want to see the change occur right away.
how can i achieve that?
Thanks, almog

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 07 Nov 2013, 11:35 AM
Hello Almog,


The Grid is not aware of changes outside of it's dataSource. In the current scenario you could use the data method of the dataSource and pass the modified array.
E.g.
var grid = $("#grid").data("kendoGrid");
grid.dataSource.data(modified_array);

Another approach would be to directly update the Grid's dataSource (instead of the array) via it's API.

Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Almog
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or