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

Switch filter type

Thread ID:

Created:

Updated:

Platform:

Replies:

143631 Mar 29,2019 01:02 PM UTC Apr 11,2019 07:03 AM UTC JavaScript 7
loading
Tags: ejGrid
Carsten Buchmann
Asked On March 29, 2019 01:02 PM UTC

Hi,

I like to switch the filter type from filterbar to excel and back:

How can I do this?

Regards,
Carsten

Vignesh Natarajan [Syncfusion]
Replied On April 1, 2019 04:09 AM UTC

Hi Carsten, 
 
Thanks for using Syncfusion products. 
 
Query: “I like to switch the filter type from filterbar to excel and back: 
 
From your query, we understand that you need to switch from filterbar to excel filter and vice versa. We have achieved your requirement by updating the filterSettings using setModel. Refer the below code example 
 
<div> 
        <input type="text" id="textFilter"> 
        <button id="buttonFilter" onClick="onFilterClick()"> 
          Filter 
        </button> 
        <button id="buttonFilterSwitch" onClick="onFilterSwitchClick()"> 
          Switch Type 
        </button> 
      </div> 
      <div id="Grid"> 
      </div> 
…………………………………………………………………………………………….. 
      <script> 
        var _filterType;       
        function onFilterSwitchClick (args) {         
          var gridObj = $("#Grid").ejGrid("instance");        
          if (gridObj.model.filterSettings.filterType == "filterbar" ) 
            _filterType = "excel"; 
          else 
            _filterType = "filterbar"; 
          gridObj.option({filterSettings: {filterType: _filterType}}) 
        } 
………………………………………………………………………………………………….. 
      </script> 
 
 
For your convenience, we have modified the provided sample which can be referred below  
 
 
Refer our API documentation for your reference 
 
 
We also would like to let you know about our next generation JavaScript product - Essential JS 2, in case if you are not aware of it. Essential JS 2 is fully re-written to be modular, responsive and lightweight.  
   
We suggest you consider our following product page for more details.  
 
   
Demo page for ej2 Grid 
  
 
Please get back to us if you have further queries.  
 
Regards, 
Vignesh Natarajan. 


Carsten Buchmann
Replied On April 1, 2019 06:04 AM UTC

Thanks for your reply. This is what I wanted.

But it leads me to my next question: How can I make the filter function work with a "OR" condition instead of "AND"?



Vignesh Natarajan [Syncfusion]
Replied On April 1, 2019 11:12 AM UTC

Hi Carsten, 
 
Thanks for the update 
 
Query: “How can I make the filter function work with a "OR" condition instead of "AND"? 
 
From your query, we understand that you need to change the filter bar message based on the filter predicate. But currently we do not have support to change the filter bar message and workaround is not also possible. So kindly use the excel filter to achieve your requirement (filter the records using or predicates). 
  
 
Regards, 
Vignesh Natarajan. 


Carsten Buchmann
Replied On April 2, 2019 06:46 AM UTC

Hi,
I dont't want to change the message. I want to change the predicate from "AND" to "OR". As you can see in the example code I already set the predicate to "or" but with no effect.

But in the meantime I tested the search function which is working well in javascript but not with a MVC Controller Action and the URL Adapter. In this case the Search and Where property of the Data Manager object is null.

Kind regards,
Carsten

Vignesh Natarajan [Syncfusion]
Replied On April 3, 2019 12:38 PM UTC

Hi Carsten, 
 
Query: “I dont't want to change the message. I want to change the predicate from "AND" to "OR". As you can see in the example code I already set the predicate to "or" but with no effect. 
 
In previously provided sample, ‘&&’ operator is used in filter message (in grid pager) to separate the two filtered columns with its value.It does not represent the predicate. So when filter button is clicked, Grid is filter with or predicate only. To ensure that it is working properly, kindly change the predicate to ‘and’ then ensure. Filtered values will be different. So values are filtered based on or predicate only. But in the filter message two strings are separated by ‘&&’. So we cannot change the filter message. So to overcome this we suggest you to use excel menu filter where you can filter the same column with or predicate.   
 
Query 2: I tested the search function which is working well in javascript but not with a MVC Controller Action and the URL Adapter. In this case the Search and Where property of the Data Manager object is null. 
 
From your query, we suspect that you are facing issue while performing searching in ejGrid with url adaptor. We are unable to reproduce the reported issue at our end. For your convenience we have created the sample.  
Also refer the below knowledge base document to perform server side operation in ejGrid.  
 
 
Output: 
 
 
Please refer the below link for the sample. 
 
After referring the sample still facing the issue, please get back to us with the following details. 
 
  1. Share the complete grid code example(both view and controller page).
  2. Share the video demonstration Or screenshot of the issue.
  3. If possible, reproduce the issue in provided sample and revert back to us.
 
Regards, 
Vignesh Natarajan. 
 


Carsten Buchmann
Replied On April 10, 2019 07:01 AM UTC

Query 1: the problem is to switch to Excel Filter. Once switched to Excel Filter the predicate is always "AND". I will work around this problem.

Query 2: I didn't use the property "AllowSearching".

Thanks for your support.

Vignesh Natarajan [Syncfusion]
Replied On April 11, 2019 07:03 AM UTC

Hi Carsten,  
 
Thanks for the update.  
 
AllowSearching must be enabled in ejGrid to perform search operation in Grid in server side.We are glad to know that your query has been resolved.  
 
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

;