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

[Solved] Server Side paging using a function call that returns the data.

1 Answer 327 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pavankumar
Top achievements
Rank 1
Pavankumar asked on 09 Dec 2014, 04:49 PM
Hi,

Our requirement is to implement server-side paging in Kendo Grid. I know that it can be achieved if we specify the Url in the datasource and Url will be automatically called with the proper page and pageSize. However, in our application, we don't have any specific Url. We are fetching the data using IBM Worklight adapters. We can call these adapters only using a JavaScript function. We can pass the page number and page size to these adapter javascript calls.

Is there any way to configure the grid so that a JavaScript method can be called automatically when ever the user requests for a new page?

Could you please help me.

Thanks,
Pavan.

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 11 Dec 2014, 12:46 PM
Hello Pavan,

You can use a function for the dataSource read operation as demonstrated in the last example from this documentation topic. In order to get the page and pageSize in the function you should enable serverPaging and use the argument data field:
var dataSource = new kendo.data.DataSource({
  serverPaging: true,
  transport: {
    read: function(options) {
        var data = options.data;
        var page = data.page;
        var pageSize = data.pageSize;
        ...
    }
  },


Regards,
Daniel
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
Pavankumar
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or