In my app it set Skip and Take in JS and send them to the server, too:
, but on the server dm.Take and dm.Skip are 0 in all cases and returns no results if in the server dm.Take is not set like this dm.Take = 10, for the example. JS code is same like in your sample:
Server side code is:
IEnumerable data = Users.Get(dm.Skip, dm.Take); //dm.Skip and dm.Take are 0
DataOperations operation = new DataOperations();
int count = data.AsQueryable().Count();
return Json(new { result = data, count = count });
In your sample it works and in the action dm.Take and Skip aren't 0 in my application there are 0.
public ActionResult DataSource(Syncfusion.JavaScript.DataManager dm)
{
int count = Users.Count();//collect the record count first
IEnumerable data = Users.Get(dm.Skip, dm.Take); //apply skip/take later
DataOperations operation = new DataOperations();
return Json(new { result = data, count = count });
} |
I don't see option to upload images or any other media, that's why I attach screens it to the comment.
With count before other code is same. You can check screens.
My JS code is copy/paste from your sample:
dataSource: dm,
allowScrolling: true,
scrollSettings: { width: "auto", height: 300, allowVirtualScrolling: true, virtualScrollMode: ej.Grid.VirtualScrollMode.Continuous },
pageSettings: { pageSize: 10, enableQueryString: true },
.......
1 of the images where dm.Take is not null is from your sample when I debug.
The image where Take and Skip are 0 is from my app when I debug.
I am using Visual Studio Community 2017.
The app is .NET Core.
I can provide files from the app, but not here, where is public.
I really need to fix this.
This sample describe the problem. It is .NET Core Syncfusion application created with Visual Studio projects->Syncfusion ASP.NET Core Web Application.
The problem is same. If you run the app you can see that there is request with take: 10, but on the server is 0.
Even more, if I send custom query like this:
.....executeQuery(new ej.Query().addParams("id", "value").requiresCount().skip(1).take(3));
I see in the console this:
, but on the server everything is null/0.
public ActionResult DataSource([FromBody]DataManager dm)
{
IEnumerable DataSource = order;
DataOperations ds = new DataOperations();
int count = DataSource.Cast<Orders>().ToList().Count();//count
if (dm.Skip >= 0)
DataSource = ds.PerformSkip(DataSource, dm.Skip);
if (dm.Take > 0)
DataSource = ds.PerformTake(DataSource, dm.Take);
return Json(new { result = DataSource, count=count });
} |
Thanks, It works.
I need to use adaptor: new ej.UrlAdaptor(), otherwise with another adaptor I am getting 415 (Unsupported Media Type), but now it works with UrlAdaptor()