Skip to content

Infragistics Community Forum / Web / Ignite UI for jQuery / Clearing Filter and Filter Text in igGrid

Clearing Filter and Filter Text in igGrid

New Discussion
Patrick
Patrick asked on Jul 19, 2018 1:44 PM

Hello,

Within our grid, we are attempting to create a simple clear filter function.  We’ve gotten the ability to reset our filter with the following line of code:

$("#grid").igGridFiltering("filter',[]);
Passing in an empty array to reset the filter.  This creates most of the performance that we want, but what does occur is that the input from the user is still within the filter input cell in the grid.  Is it possible to basically call the “clear filter” option (one of the filter options in the grid ui itself)?
Thanks.
Sign In to post a reply

Replies

  • 0
    [Infragistics] Surya
    [Infragistics] Surya answered on Oct 9, 2012 8:22 PM

    Dear Patrick,

    Thank you for contacting Infragistics!

    We received your support request concerning Clearing filter and filter text in igGrid, and this case has been assigned to me. Infragistics is dedicated to helping you solve this issue.

    I am looking into this issue and will get back to you by the end of the day Thursday with more information or questions for you.

     

  • 0
    [Infragistics] Tsvetelina Georgieva
    [Infragistics] Tsvetelina Georgieva answered on Oct 10, 2012 2:08 PM

    Hello Patrick,

    It seems that the “updateUI” parameter is not taken into account when empty array is used in order to reset the filter

    https://www.igniteui.com/help/api/2022.2/ui.iggridfiltering

    An development issue will be submitted regarding this.

    As a temporary workaround you can use the following code snippet

    function clearFilter() {
    
    
    
    
            var $gridFiltering = $("#grid1").data("igGridFiltering");
    
    
    
    
            $gridFiltering.filter([],true);
    
    
    
    
            var editors = $gridFiltering._editors;
    
    
    
    
            for (var i = 0; i < editors.length; i++) {
    
    
    
    
                editors[i].value(null);
    
    
    
    
            }
    
    
    
    
    //      $("#grid1").igGridFiltering("filter", ([{ fieldName: "ProductID", expr: '', cond: "equals"}]));
    
    
    
    
    //      $("#grid1").igGridFiltering("filter", ([{ fieldName: "Color", expr: '', cond: "contains"}]));
    
    
    
    
    }

     

    Hope this helps.

    • 0
      Patrick
      Patrick answered on Oct 10, 2012 2:51 PM

      Thanks, Tsvetelina!  That snippet worked exactly as expected.

      Out of curiosity, is it possible to set the editor's values/text and programmatically invoking a filter event via filling in the igGridFiltering input?

      For example, could I do something like:

      editors[i].value("5"); //Assuming i is equal to a ProductID column

      editors[i].text("5"); 

      Would this execute a filter event?

      • 0
        [Infragistics] Tsvetelina Georgieva
        [Infragistics] Tsvetelina Georgieva answered on Oct 10, 2012 4:24 PM

        Hello Patrick,

        Using this approach you wil change only the value of the filtering editor but this won’t invoke the filtering event.

        You need to use the filter method for the purpose.

        function clearFilter() { 
        
        
        
        
            var colSettings = $("#grid1").igGridFiltering("option", "columnSettings");
        
        
        
        
            for (var i = 0; i < colSettings.length; i++) {
        
        
        
        
                $("#grid1").igGridFiltering("filter",
        
        
        
        
                ([{ fieldName: colSettings[i].columnKey, expr: '5', cond: colSettings[i].condition}]));
        
        
        
        
            }
        
        
        
        
        }

         

        Let me know if you have further questions.

      • 0
        Pete Cougan
        Pete Cougan answered on Jul 18, 2018 6:12 PM

        Hi, is there a way to invoke the trigger to filter the grid? When I use .igGridFiltering, I keep getting the error saying "cannot call methods on igGridFiltering prior to initialization; attempted to call method 'option'"

      • 0
        Alan Halama
        Alan Halama answered on Jul 19, 2018 1:44 PM

        Pete,

        I recommend starting a new thread and including more details and including an example if possible.  At least include the relevant code that you are using.

      • 0
        [Infragistics] Surya
        [Infragistics] Surya answered on Oct 16, 2012 3:15 PM

        Hello Patrick,

        I have linked you case to the Development issue 124163. You will be notified once the service release is out include this fix.

        Please let me know if I can provide any further assistance regarding this matter.

    • 0
      Ilyasse R
      Ilyasse R answered on Jul 25, 2016 3:45 PM

      Hi thank's for your help, i tried your solution but it doesn't work propably because i have a posterior version of infragistics ! I have a Date column that could be filter by date of today, past year, actual year … When i reset filters the grid refresh correctly but the column date keep the last filter so if i filter again with another feild they take in consideration the two column condition, thus it filter the first time in the date and a second time for the other column.

      Is there any recent solution to solve this problem or another way to refresh the filtered column ? 

      Thank's for your time and your explanation.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Patrick
Favorites
0
Replies
8
Created On
Jul 19, 2018
Last Post
8 years ago

Suggested Discussions

Created by

Created on

Jul 19, 2018 1:44 PM

Last activity on

Feb 25, 2026 9:50 AM