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

Kendo Grid - Server Side Paging

1 Answer 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Venkat
Top achievements
Rank 1
Venkat asked on 14 Dec 2015, 05:58 AM

Hi 

I have implemented server side paging in kendo grid. I am facing one issue.

Issue Description - there are 2333 records in my table and per page records are configurable (20, 50 and 100). it is working fine. i navigate to 2nd page and try to apply filter on one of the column. when i debug the code on controller method, i noticed that request.page is 1, ideally it should be a page no where user in the grid. in our case it should be 2.

Controller code - 

 public ActionResult GetAutoBlockCardsGridBySearch([DataSourceRequest] DataSourceRequest request, AutoBlockRequestInput model)
        {
            int totalRows;
            var result = _autoBlockCardsAPIController.GetAllAutoBlockCards(model, request.Page, request.PageSize, out totalRows).OrderBy(a => a.MaskedCardNumber);
            List<AutoBlockRequest> AutoBlockCardsList = new List<AutoBlockRequest>();

            if (null != result && result.Count() > 0)
            {
                AutoBlockCardsList = result.ToList();
            }
            request.Page = 0;
            var response = result.ToDataSourceResult(request); 
            response.Total = totalRows;
            return Json(response);
        }

Can you please let me know if anything wrong in code or is it bug in kendo grid?

Thanks,

Dharmesh

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 16 Dec 2015, 07:44 AM
Hello Dharmesh,

Filtering resets the page number by design and the observed behavior is expected. The idea is that filtering produces less table rows than the ones the Grid is currently bound to. As a result, the user may be on a page, which will not exist after the filtering is complete. For example:

Step 1.
- page size is 50
- total number of items is 130
- user is on page 2

Step 2.
- user performs filtering
- the resulting total number of items is 40
- page 2 no longer exists

From usability point of view, it is also best if the user is navigated to the first page of a newly displayed data set.

Can you describe a valid scenario in which the user should be left on the page he is currently on, after filtering? Please keep in mind that even if this page still exists, it will show different data items, so seeing this page may not bring any benefit to the user.

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