Dhwani
Dhwani

Reputation: 7626

Stop Kendo Grid to make server call while moving to first page

I am using kendo grid with AutoBind(false) option. Now i fill data in kendo grid based on user's criteria. Now issue is that when I apply following code it makes two server side call.

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

And when I debugged the code, I found that $('#KendoListData').data('kendoGrid').dataSource.page(1); statement fire server call.

So is there anyway to stop server call and move to first page?

Upvotes: 0

Views: 791

Answers (2)

Vanice
Vanice

Reputation: 676

You can use client side paging by turning serveroperations off at the datasource.

.DataSource(dataSource => dataSource
  .Ajax()
  .ServerOperation(false)
  ...)

But now all data is send to the client not just the currently displayed page/filter/group.

Upvotes: 1

Abbas Galiyakotwala
Abbas Galiyakotwala

Reputation: 3019

Use dataBound and set page number, it wont makes two server side call.

$('#KendoListData').data('kendoGrid').one("dataBound", function() {
                this.dataSource.page(2);
});

I hope this will help you :)

Upvotes: 0

Related Questions