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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

129443 Mar 17,2017 10:08 PM Mar 20,2017 11:56 PM ASP.NET Core 3
loading
Tags: Grid
Morgan
Asked On March 17, 2017 10:08 PM

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 10:17 AM

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 11:30 AM

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 20, 2017 11:56 PM

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.

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.

;