We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

how to paging properly in grid

Thread ID:

Created:

Updated:

Platform:

Replies:

130879 Jun 8,2017 07:13 AM Jun 9,2017 02:54 AM ASP.NET MVC 1
loading
Tags: Grid
Dongil Shin
Asked On June 8, 2017 07:13 AM

Hi, I'm reviewing the existing code related to paging in grid.
the symptom of the grid is 
supposed that there are 20 records in total, if I set the page size as 5. then it makes 4 pages.

in actual behaviour in the grid is that it just shows the whole 20 records,
however, the page number is displayed as 1.2.3.4.

that means, the page calculation is ok but it does not react/respond data to the specific page range like 1st page, 2nd page, 3rd page and 4th page.

Please let me know the solution.

Thank you.
Kind Regards,

Jayaprakash Kamaraj [Syncfusion]
Replied On June 9, 2017 02:54 AM

Hi Dongil, 

Thank you for contacting Syncfusion support. 

We suspect that you have using URLAdaptor in Grid. While using UrlAdaptor, you need to handle grid operation (paging/filtering/searching/sorting) in server side. When performing paging, filtering, sorting, editing operations on the grid queries are passed to the server side using DataManager class.  
 
Note: skip/take are the queries responsible for handling the paging action  
  
  
The response from server should be wrapped in an object with properties named result to hold the data and count to hold the total records count. To handle the server-side operations, we have Server-side APIs which has been found in the DataOperations class of Syncfusion Libraries. Refer to the following KB.  
  

@(Html.EJ().Grid<object>("FlatGrid") 
         .Datasource(ds => ds.URL("/Home/DataSource").Adaptor("UrlAdaptor")) 
         .AllowFiltering() 
         .AllowSorting()    /*Sorting Enabled*/ 
         .AllowPaging()    /*Paging Enabled*/ 
         .PageSettings(eve=>eve.PageSize(5)) 
         .FilterSettings(eve=>eve.FilterType(FilterType.Excel)) 
         .Columns(col => 
        { 
            col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add(); 
         .. 
       })) 
 
        public ActionResult DataSource(Syncfusion.JavaScript.DataManager dm) 
        { 
            IEnumerable Data = OrderRepository.GetAllRecords(); 
            Syncfusion.JavaScript.DataSources.DataOperations operation = new Syncfusion.JavaScript.DataSources.DataOperations(); 
.. 
            int count = Data.AsQueryable().Count(); 
            if (dm.Skip != 0) 
            { 
                Data = operation.PerformSkip(Data, dm.Skip); //paging 
            } 
            if (dm.Take != 0) 
            { 
                Data = operation.PerformTake(Data, dm.Take); //paging 
            } 
            return Json(new { result = Data, count = count }, JsonRequestBehavior.AllowGet); 
        } 
 

We have prepared a Grid sample with UrlAdaptor that can be downloaded from the following link. 


 

If you still facing the issue, please share the following information to serve you better.  
 
  1. Grid rendering code example both client and server.
  2. Essential studio  and browser version details.
  3. Please open the console window in the browser and check whether any script error throws.
  4. An issue reproducing sample if possible or hosted link or replicate the issue in the attached sample
Regards, 

Jayaprakash K. 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;