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.