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

how to set two filters of the same column programmatically

Thread ID:

Created:

Updated:

Platform:

Replies:

143152 Mar 6,2019 03:50 PM UTC Mar 7,2019 04:39 AM UTC JavaScript 1
loading
Tags: ejGrid
Luis Carlos
Asked On March 6, 2019 03:50 PM UTC

Good evening.


I would like to set two filters of the same column programmatically. I could use the "filterColumn" method.  

This method works properly when there are two filters of different columns. However, if there are two filters of the same column, it only gets the last filter.


I will be waiting for your reply, thank you in advance.

Regards, Luis Carlos.



Vignesh Natarajan [Syncfusion]
Replied On March 7, 2019 04:39 AM UTC

Hi Luis, 
 
Thanks for contacting Syncfusion support.  
 
Query: “I would like to set two filters of the same column programmatically” 
 
From your query, we understand that you need to filter the same column with two values. We suggest you to achieve your requirement using filterSettings API and refreshContent() method of ejGrid. Refer the below code example 
 
<ej-grid id="FlatGrid" allow-paging="true" datasource="ViewBag.dataSource" allow-filtering="true"> 
    <e-filter-settings filter-type="Excel" />     
    <e-columns> 
        ……………………………………………………………. 
    </e-columns> 
</ej-grid> 
 
<script type="text/javascript"> 
    function onClick() { // external button click event 
        var Obj = $("#FlatGrid").ejGrid("instance"); 
        Obj.model.filterSettings.filteredColumns.push({ field: "ShipCity", operator: "startswith", value: "Be", predicate: "or", matchCase: true }); 
        Obj.model.filterSettings.filteredColumns.push({ field: "ShipCity", operator: "startswith", value: "Ts", predicate: "or", matchCase: true }); 
        Obj.refreshContent(); 
    } 
</script> 
  
 
Refer our API documentation for your reference 
 
 
 
Please get back to us if you have further queries. 
 
Regards, 
Vignesh Natarajan. 


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

;