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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Multiple filters on one column

Thread ID:

Created:

Updated:

Platform:

Replies:

145877 Jul 11,2019 06:39 PM UTC Jul 16,2019 04:06 AM UTC jQuery 5
loading
Tags: ejGrid
Matthew
Asked On July 11, 2019 06:39 PM UTC

Hello,

Is it possible to apply multiple filters onto the same column. Like this

$("#SearchGrid").ejGrid("filterColumn", [{ field: "Type", operator: "contains", value: "B", predicate: "and", matchcase: false }, { field: "Type", operator: "contains", value: "B", predicate: "and", matchcase: false }]);

What I am attempting is to show rows of "Type" that contain "A" and also contain "B". 

Manivannan Padmanaban [Syncfusion]
Replied On July 12, 2019 11:09 AM UTC

Hi Matthew, 

We have achieved your requirement kindly refer the below code example, 

 
    <button id="btn" onclick="Filter()"> 
        Click here to filter 
    </button> 
………………….. 
    <div id="Grid"></div> 
    <script type="text/javascript"> 
        $(function () { 
……………………… 
            $("#Grid").ejGrid({ 
……………………………….. 
                allowFiltering: true, 
                filterSettings: { filterType: "excel" }, 
                columns: [ 
…………………………………………….. 
                ] 
            }); 
        }); 
 
        function Filter() { 
            var gridObj = $("#Grid").ejGrid("instance"); // create the grid instance using grid ID. 
            gridObj.filterColumn([ 
                { field: "CustomerID", operator: "contains", value: 'o', predicate: "and", matchcase: false }, 
                { field: "CustomerID", operator: "contains", value: 'u', predicate: "and", matchcase: false }, 
            ]) 
        } 
………………………….. 
    </script> 
</body> 
</html> 


Refer the below link for sample. 

Regards, 
Manivannan Padmanaban. 


Matthew
Replied On July 12, 2019 06:13 PM UTC

Thank you, the code helped clarify the method. Also the problem was that during initializing my grid I had

filterSettings: { filterType: "menu" }

when what was required was,

filterSettings: { filterType: "excel" }


Manivannan Padmanaban [Syncfusion]
Replied On July 15, 2019 08:53 AM UTC

Hi Matthew, 

Thanks for the update. 

You can use the same solution for the filter type menu as well. Excel filter is work based on “and” predicate where else menu is work based on “or” predicate. For example, in the shared example we have filtered the CustomerID column which contains the value as “o” and “u”. In excel filter, due to “and” operation is shows the result as the value which contains both “o” and “u”. But the menu filter, due to “or” operation first it filter the values which contains “o” and later it filter the value which contains “u” which is the default behavior.  

Kindly get back to us, if you need further assistance. 

Regards, 
Manivannan Padmanaban. 


Matthew
Replied On July 15, 2019 02:09 PM UTC

Thank you for clearing that up Manivannan, and for your assistance.


Manivannan Padmanaban [Syncfusion]
Replied On July 16, 2019 04:06 AM UTC

Hi Matthew, 

Thanks for the update. 

Kindly get back to us, if you need further assistance. 

Regards, 
Manivannan Padmanaban. 


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.

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

Live Chat Icon For mobile
Live Chat Icon