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

Filter Grid from js

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 ?

4 Replies

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

BM Balaji Marimuthu Syncfusion Team 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

RA RA December 16, 2015 08:48 AM UTC

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

Thanks a lot

BM Balaji Marimuthu Syncfusion Team 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

Live Chat Icon For mobile
Up arrow icon