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.
Unfortunately, activation email could not send to your email. Please try again.

clearFiltering throws Error

Thread ID:

Created:

Updated:

Platform:

Replies:

132680 Sep 15,2017 02:20 AM Sep 18,2017 06:59 AM Angular 1
loading
Tags: ejGrid
Bernd Schuhmacher
Asked On September 15, 2017 02:20 AM

Hi

When tinkering with some filtering on a grid I observed the following.

If I use the clearFiltering Method on a column that was not filtered before it throws an error when the filterType is set to 'excel'. It works if the filterType is set to 'filter bar'. Is this a bug with the 'excel' grid?

If this is a wanted feature is there a straightforward way to find out if a filter is set for a given column? I don’t think it is straightforward to get all filters from *.widget.model.filterSettings.filteredColumns and run through all entries looking for the value of ‘field’.

Regards

Bernd

 


Mani Sankar Durai [Syncfusion]
Replied On September 18, 2017 06:59 AM

Hi Bernd, 

Thanks for contacting Syncfusion support. 

We have analyzed your query and we are able to reproduce the reported issue. We have confirmed that the issue “Script error throws when clearFiltering without filtering the columns” is a defect, and we have logged a defect report. The fix for this issue will be included in our Volume 3 SP2, 2017 release expected to be out by the month of September, 2017. 
Until then we suggest you to use the below workaround solution which helps to solve this issue.  
Refer the code example 
... 
                <button id="btn" onclick="myFunc()">Clear filter</button> 
                <div id="Grid"></div> 
... 
<script type="text/javascript"> 
   
    $(function () { 
        $("#Grid").ejGrid({ 
            dataSource: window.gridData, 
... 
            allowFiltering: true, 
            filterSettings:{filterType:"excel"}, 
            columns: [ 
                ...           
        }); 
    }); 
 
    </script> 
    <script> 
        function myFunc(){ 
            var grid = $('#Grid').ejGrid("instance"); 
            if (grid.filterColumnCollection.length) {  //check the condition if the column is filtered before calling clearFiltering method 
                grid.clearFiltering(grid.filterColumnCollection[0].field); 
            } 
        } 
    </script> 

We have prepared a simple sample link in JSPlayground that can be available under the below link. 

Regards, 
Manisankar Durai. 



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.

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.

;