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. Image for the cookie policy date

Paginacion

Hola:

Como puedo realizar la paginacion en el controlador, para enviar los datos paginados a la vista, hay alguna forma de hacerlo, ya que todos los ejemplos que he visto realizan la paginacion en el lado de la vista o del cliente.

De antemano muchas gracias.
Atte.

1 Reply

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team December 5, 2016 01:47 PM UTC

Hi Juan, 
 
We suspect that would like to handle server-side paging. This can be achieved using the URLAdaptor (of DataManager) which will be assigned as DataSource to the Grid. URLAdaptor manages the server actions which sends the POST requesting the data DataManager queries. So we can retrieve the required number of data and populate the same in Grid. DataManager also provides the Server-Side APIs to handle the Paging action in the server. AllowPaging must be enabled in the Grid to perform paging action in the server-end. Refer to the following code example. 
 
@(Html.EJ().Grid<MvcApplication66.OrdersView>("FlatGrid") 
        .Datasource(ds => 
            ds.URL("/Home/DataSource") 
            .Adaptor(AdaptorType.UrlAdaptor)) 
        .AllowPaging() 
             . . . 
                 . ..  
) 
 
        public ActionResult DataSource(Syncfusion.JavaScript.DataManager dm) 
        { 
            IEnumerable DataSource = new NorthwindDataContext().OrdersViews.ToList(); 
            DataOperations ds = new DataOperations(); 
            DataResult result = new DataResult(); 
            result.count = DataSource.AsQueryable().Count();//count 
            if (dm.Skip != null) 
                DataSource = ds.PerformSkip(DataSource, dm.Skip); 
            if (dm.Take != null) 
                DataSource = ds.PerformTake(DataSource, dm.Take); 
            result.result = DataSource; //resultant data 
            return Json(result, JsonRequestBehavior.AllowGet); 
        } 
 
Note: ReturnType of the READ (URL) Method must be result/count pair.  
 
Refer to the following Help Document. 
 
 
Likewise, we can perform other Grid actions like Filtering, Sorting in the Server-end. Refer to the following KB for the Server-side APIs DataManager. 
 
 
We have also prepared a sample that can be downloaded from the following location. 
 
 
Regards, 
Seeni Sakthi Kumar S. 


Loader.
Up arrow icon