5
votes

I am having a problem while refreshing the kendo grid, for some reason, the dataBound event is activated twice, does someone know what could be the problem? or is this a normal behavior?

$("#grid").data('kendoGrid').dataSource.read();
$("#grid").data('kendoGrid').refresh();

UPDATE:

if i remove the refresh line, the dataBound happens only once

$("#grid").data('kendoGrid').refresh();
3
Why do you need to call refresh()?Rick S
all examples show the grid refresh using this code, but just now i see the event run twice, but without refresh works fineLucas Konrath
@LucasKonrath It is because you call dataSource.read() and it gets data from remote (or may client-side) so first Databound happens, then you call refresh() it means bound me again to datasource so second Databound happens.Iman Mahmoudinasab

3 Answers

0
votes

If you're simply wanting to update the data, you shouldn't need to call Refresh(). DataSource.Read() should do.

0
votes

You can remove the below lines to:

$("#KendoGridId").data("kendoGrid").dataSource.read();
$("#KendoGridId").data("kendoGrid").dataSource.page(1);

to:

$("#KendoGridId").data("kendoGrid").dataSource.read();