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. Image for the cookie policy date

The allow-filter is being ignored when my grid data comes from datamanger

Hi Support:

I have an issue with the filtering in a grid whose data comes from a datamanager as follows:

<ej-grid id="grid"
                         allow-filtering="true"
                         allow-scrolling="true"
                         allow-selection="false"
                         allow-paging="true"
                         is-responsive="false">
                    <e-datamanager url="/Order/Datasource" adaptor="UrlAdaptor" />
                    <e-columns>

The filter icons are being displayed, but when you set a filter, it is ignored.

Any ideas.

Thanks

David


1 Reply

MS Mani Sankar Durai Syncfusion Team August 31, 2017 10:43 AM UTC

Hi David. 
 
 
Thanks for contacting Syncfusion support. 
 
 
 We have analyzed your and we suspect that you would like to perform Filtering operation when using UrlAdaptor in grid. When using the UrlAdaptor we suggest you to perform server side operation in grid when performing sorting, filtering, paging, grouping etc.., 
 
Refer the code example. 
<ej-grid id="FlatGrid" allow-paging="true" allow-filtering="true" > 
    <e-filter-settings filter-type="Excel"></e-filter-settings> 
   <e-datamanager url="/Home/DataSource" adaptor="UrlAdaptor"></e-datamanager> 
      <e-columns> 
        <e-column field="OrderID" header-text="Order ID" is-primary-key="true" text-align="Right" width="75"></e-column> 
         <e-column field="CustomerID" header-text="Customer ID"  width="75"></e-column> 
          <e-column field="ShipCity" header-text="Ship City" width="75"></e-column> 
      </e-columns> 
</ej-grid> 
 
In the server side we can get it from the DataManager Class which contains the object for every grid actions like filtering, sorting, grouping, skip and take (i.e paging) etc..,  

Refer the code example. 
[HomeController.cs] 
public ActionResult DataSource([FromBody]DataManager dm)//Using DataManager class which contains Sorting, filtering as a parameter.   
        {….    } 
 
Please refer the below code example which contains server side operations. Using DataOperations class each actions in grid takes place. 

using Syncfusion.JavaScript.DataSources; 
using Syncfusion.Linq; 
using Syncfusion.JavaScript.Models; 
  public ActionResult DataSource([FromBody]DataManager dm) 
        { 
            IEnumerable data = orddata; 
            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 }); 
 
        } 
 
 
 
Refer the KB link of how to perform server side grid actions 
 
We have also prepared a sample that can be downloaded from the below link. 

If you still face the issue please share us the following details, 

1.       Share the screenshot/ video of the issue that you have faced. 
2.       Share the controller page. 
3.       Share the hosted site. 
4.       If possible please reproduce the issue in the above attached sample. 

The provided information will help us to analyze the issue and provide you the response as early as possible  


Please let us know if you need further assistance, 


Regards, 
Manisankar Durai. 




Loader.
Up arrow icon