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

Query Remote DataSource locally or Set Page after Receive Data from Remote Server

1 Answer 110 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Antony
Top achievements
Rank 1
Antony asked on 18 Jun 2012, 01:06 AM
Hi all,

First of all I want to say thanks for this great tools to accelerate web development. I am new to Kendo UI, and just learning about the KendoUI Grid. I am using a remote data source with server paging, filtering, sorting. Most of all the things already working nicely (thanks to this great tools). But right now I am facing a problem which related to the paging. 

The problem is actually very simple, I have data with several pages. If I navigate through the grid pager, for example currently right now I am navigating to page 3. The I apply a filter to the grid, which only have 1 page in total, the grid will display no data since the page displayed by the grid right now is 3. Is there any way/workaround to this problem? For example querying local data after retrieve from the remote data to set the page automatically to page 1 when the available page is less than current page navigated in the pager.

Thanks before for help. Thanks !!

1 Answer, 1 is accepted

Sort by
0
Jackie
Top achievements
Rank 1
answered on 19 Jun 2012, 10:37 AM
          var dataSrc = new kendo.data.DataSource({
                transport: {
                    read: {
                        //the following is $.ajax options
                            type: "POST",
                        url: "JsonDataSrc.ashx",
                        dataType: "json"
                    }
                },
                schema: {
                    // get Data
                    data: function (d) { return d.Data; },
                    // get total data count (for paging)
                    total: function (d) { return d.TotalCount; }
                },
                pageSize: 10,
                serverPaging: true,
                serverSorting: true
            });
reference: http://blog.darkthread.net/post-2011-12-31-kendo-ui-grid.aspx
Tags
Data Source
Asked by
Antony
Top achievements
Rank 1
Answers by
Jackie
Top achievements
Rank 1
Share this question
or