How to send only the request of the current page?


How is the page made when the requests are large?

It takes a long time to load the information

1 Reply

BS Balaji Sekar Syncfusion Team February 24, 2020 04:31 PM UTC

Hi EDGAR, 
 
Greetings from Syncfusion forum. 
 
We suspect your reported issue may occurs in while using remote data in your application. You can achieve your requirement by enabling paging property like allowpaging as true in grid. By default, current page as consisting the row records depends upon the pagesize. 
 
If paging is enabled, grid sent request for current page data only. Its works like on demand concept. If navigate to another page next page size records loaded from dataSource. So, it’s don’t take more time to load. 
 
Here we have prepared a sample with UrlAdaptor. Please find the below on-Demand action code snippet and sample link.  
 
public ActionResult UrlDatasource(DataManagerRequest dm) 
        { 
 
            IEnumerable DataSource = OrdersDetails.GetAllRecords().ToList(); 
            DataOperations operation = new DataOperations(); 
 
            if (dm.Search != null && dm.Search.Count > 0) 
            { 
                DataSource = operation.PerformSearching(DataSource, dm.Search);  //Search 
            } 
            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting 
            { 
                DataSource = operation.PerformSorting(DataSource, dm.Sorted); 
            } 
            if (dm.Where != null && dm.Where.Count > 0) //Filtering 
            { 
                DataSource = operation.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator); 
            } 
            int count = DataSource.Cast<OrdersDetails>().Count(); 
            if (dm.Skip != 0) 
            { 
                DataSource = operation.PerformSkip(DataSource, dm.Skip);   //Paging 
            } 
            if (dm.Take != 0) 
            { 
                DataSource = operation.PerformTake(DataSource, dm.Take); 
            } 
            return dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource); 
        } 
 
 
var data = new ej.data.DataManager({ 
       url: '/Home/UrlDatasource'
        adaptor: new ej.data.UrlAdaptor() 
    }); 
    var grid = new ej.grids.Grid({ 
. . .  
        columns: [ 
. . .  
        ], 
        height: 260 
    }); 
    grid.appendTo('#grid1'); 
 
 
 
 
                           : https://ej2.syncfusion.com/documentation/grid/data-binding/#remote-data 
 
 
Please get back to us, if you need any further assistance. 
 
Regards, 
Balaji Sekar. 


Loader.
Up arrow icon