Hi Lory,
We have analyzed the snippet that you have shared.
When retrieving the data from MVC controller, it is essential to specify the adaptor property of the ejDataManager. If you are not specifying any adaptor for the dataSource, then by default the adaptor type is considered as
ODataAdaptor.
So we suggest you to mention the adaptor property of the ejDataManager. When mentioning the adaptor as “
UrlAdaptor”, all the details corresponding to grid actions are obtained at the server side in the
DataManager Class. Please refer to the following online documentation links for more information on data binding and data adaptors.
https://help.syncfusion.com/aspnetmvc/datamanager/data-adaptorshttps://help.syncfusion.com/aspnetmvc/datamanager/data-binding Since in your snippet, whole dataSource is written in the Response in the MVC controller rather than considering the skip and top properties passed in the queryString, the whole dataSource is bound to every page of the grid and thus pageSize is not reflected in grid.
When using “
UrlAdaptor”, the records are loaded based on “load on demand” mechanism. The details of the number of data to be retrieved will be obtained in skip and take parameters of the DataManager Class. Please refer to the following code example on how the data is filtered using the skip and take parameters of the DataManager Class
public ActionResult Event(DataManager dm) { IEnumerable DataSource = OrderRepository.GetAllRecords(); DataResult result = new DataResult(); DataOperations operation = new DataOperations(); result.result = DataSource; result.count = result.result.AsQueryable().Count(); if (dm.Skip > 0) result.result = operation.PerformSkip(result.result, dm.Skip);
if (dm.Take > 0) result.result = operation.PerformTake(result.result, dm.Take);
return Json(result, JsonRequestBehavior.AllowGet); }
|
Please refer the below screenshot:
We have created a sample using
UrlAdaptor, which can be downloaded from the following location.
Sample Link:
https://www.syncfusion.com/downloads/support/forum/120173/ze/Sample463514340 Regards
Ragavee U S