- Home
- Forum
- ASP.NET Core
- Grid, Datamanager, new ej.Query() ... etc
Grid, Datamanager, new ej.Query() ... etc
When producing a query to "filter" the results down the TAKE which I would set in the query results in being 0 (zero) value in the DM in the ActionResult(DataManager Dm) {}
it never changes....
SIGN IN To post a reply.
3 Replies
FS
Farveen Sulthana Thameeztheen Basha
Syncfusion Team
March 20, 2017 02:17 PM UTC
Hi Morgan,
Thanks for contacting syncfusion support.
We have created sample according to your requirement which can be downloaded from the below location.
In this sample, we have used “UrlAdaptor” of ejDataManger when binding datasource from remote data. While passing parameter to DataManager class for performing serverside operation, you have to use [FromBody] in front of the parameter i. e. ([FromBody]DataManager dm).
Please refer to the code example:-
| View side:- <ej-grid id="Grid" datasource=ViewBag.data allow-paging="true"> <e-datamanager url="/Home/DataSource"adaptor="UrlAdaptor" /> <e-edit-settings allow-adding="true" allow-editing="true" allow-deleting="true" "></e-edit-settings> <e-toolbar-settings show-toolbar="true" toolbar-items='@new List<string> {"add","edit","update","cancel"}' /> <e-columns> <e-column header-text="Order ID" field="OrderID" is-primary-key="true" is-identity="true" /> <e-column header-text="Customer ID" field="CustomerID" /> <e-column header-text="Employee ID" field="EmployeeID" /> <e-column header-text="Freight" field="Freight" format="{0:C2}" /> </e-columns> </ej-grid> Controller side:- public ActionResult DataSource([FromBody]DataManager dm) { IEnumerable data = order; DataOperations operation = new DataOperations(); if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting { data = operation.PerformSorting(data, dm.Sorted); } if (dm.Where != null && dm.Where.Count > 0) //Filtering { data = operation.PerformWhereFilter(data, dm.Where, dm.Where[0].Operator); } int count = data.Cast<Orders>().Count(); if (dm.Skip != 0) { data = operation.PerformSkip(data, dm.Skip); } if (dm.Take != 0) { data = operation.PerformTake(data, dm.Take); } return Json(new { result = data, count = count }); } |
Regards,
Farveensulthana T
Hi Morgan,
Thanks for contacting syncfusion support.
We have created sample according to your requirement which can be downloaded from the below location.
In this sample, we have used “UrlAdaptor” of ejDataManger when binding datasource from remote data. While passing parameter to DataManager class for performing serverside operation, you have to use [FromBody] in front of the parameter i. e. ([FromBody]DataManager dm).
Please refer to the code example:-
View side:-<ej-grid id="Grid" datasource=ViewBag.data allow-paging="true"><e-datamanager url="/Home/DataSource"adaptor="UrlAdaptor" /><e-edit-settings allow-adding="true" allow-editing="true" allow-deleting="true" "></e-edit-settings><e-toolbar-settings show-toolbar="true" toolbar-items='@new List<string> {"add","edit","update","cancel"}' /><e-columns><e-column header-text="Order ID" field="OrderID" is-primary-key="true" is-identity="true" /><e-column header-text="Customer ID" field="CustomerID" /><e-column header-text="Employee ID" field="EmployeeID" /><e-column header-text="Freight" field="Freight" format="{0:C2}" /></e-columns></ej-grid>
Controller side:-public ActionResult DataSource([FromBody]DataManager dm){IEnumerable data = order;DataOperations operation = new DataOperations();if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting{data = operation.PerformSorting(data, dm.Sorted);}if (dm.Where != null && dm.Where.Count > 0) //Filtering{data = operation.PerformWhereFilter(data, dm.Where, dm.Where[0].Operator);}int count = data.Cast<Orders>().Count();if (dm.Skip != 0){data = operation.PerformSkip(data, dm.Skip);}if (dm.Take != 0){data = operation.PerformTake(data, dm.Take);}return Json(new { result = data, count = count });}
Regards,
Farveensulthana T
that is the ticket... completely forgot about [FromBody]
SS
Seeni Sakthi Kumar Seeni Raj
Syncfusion Team
March 21, 2017 03:56 AM UTC
Hi Morgan,
Thanks for the update.
Please let us know whether the reported problem resolved at your end.
Regards,
Seeni Sakthi Kumar S.
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
-
MO Morgan
- Mar 18, 2017 02:08 AM UTC
- Mar 21, 2017 03:56 AM UTC