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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid, Datamanager, new ej.Query() ... etc

Thread ID:

Created:

Updated:

Platform:

Replies:

129443 Mar 18,2017 02:08 AM UTC Mar 21,2017 03:56 AM UTC ASP.NET Core 3
loading
Tags: Grid
Morgan
Asked On March 18, 2017 02:08 AM UTC

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....

Farveen Sulthana Thameeztheen Basha [Syncfusion]
Replied On 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 


Morgan
Replied On March 20, 2017 03:30 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 


that is the ticket... completely forgot about [FromBody]

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On 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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;