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

Filter Grid from js

Thread ID:





121437 Dec 15,2015 09:10 AM UTC Dec 17,2015 06:57 AM UTC ASP.NET MVC 4
Tags: Grid
Asked On December 15, 2015 09:10 AM UTC

Hi all
I am using EJ().Grid() and trying to filter it from js like this:

var grid = $("#MyGrid").data("ejGrid");
grid.filterColumn("Age", "greaterthanorequal", 15);

However, I need to filter it by more than one column, in one ajax request.

can anybody help with this please ?

Replied On December 15, 2015 09:20 AM UTC

I am trying to filter the grid by a DateTime property, and to apply a "between" operator.
I saw that this is not supported by default operators, so I tried to use "lessthanorequal" and "greaterthanorequal".
But for this to work, I need to apply both filters in one ajax call, and this is what I am trying to figure out.

Balaji Marimuthu [Syncfusion]
Replied On December 16, 2015 08:42 AM UTC

Hi Rami,

Thanks for contacting Syncfusion support.

To achieve your requirement we suggest you to push the filter values to the filteredColumns property in filterSettings and call the refreshContent method to refresh the grid content in order to display the filtered records. Refer to the code example and sample as below.
Sample: Filtercolumn

<input id="btn" type="button" value="filter" onclick="btnclick()" />



         .AllowPaging()    /*Paging Enabled*/


        .Columns(col =>


            col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();

            col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add();

            col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(75).Add();


            col.Field("OrderDate").HeaderText("Order Date").TextAlign(TextAlign.Right).Width(80).Format("{0:MM/dd/yyyy hh:mm:ss}").Add();



<script type="text/javascript">

    function btnclick() {

        var obj = $("#FlatGrid").ejGrid("instance");

        obj.model.filterSettings.filteredColumns.push({ field: "OrderDate", operator: "lessthanorequal", value: new Date("11/11/1997"), matchcase: false, predicate: "and" });

        obj.model.filterSettings.filteredColumns.push({ field: "OrderDate", operator: "greaterthanorequal", value: new Date("05/06/1997"), matchcase: false, predicate: "and" });

        obj.refreshContent();//refresh the grid content



In above code example, we have filtered the columns in button click. Refer to the Document for more information in following link.

Query: However, I need to filter it by more than one column, in one ajax request.
Are you want to perform the filtering operation in server side/ AJAX success? Please

Please let us know if you have any concerns.

Balaji Marimuthu

Replied On December 16, 2015 08:48 AM UTC

I was doing the same thing, but forgot to set predicate = "and"

Thanks a lot

Balaji Marimuthu [Syncfusion]
Replied On December 17, 2015 06:57 AM UTC

Hi Rami,

Thanks for the update.

We are happy that the provided solution helped you. Please get back to us if you need any further assistance. We will be happy to assist you.

Balaji Marimuthu


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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