Author Topic: Clear Filters  (Read 6253 times)

angelahlp

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
Clear Filters
« on: March 03, 2014, 02:01:52 am »
Is there an easy way to clear all filters?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: Clear Filters
« Reply #1 on: March 03, 2014, 10:04:26 am »
Easy way to turn off all filters is by setting on:false in the filterModel.

http://paramquery.com/pro/api#option-filterModel

angelahlp

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
Re: Clear Filters
« Reply #2 on: March 03, 2014, 10:50:05 am »
I've added this button to my grid toolbar but when clicked it does nothing?

                { type: 'button', label: 'Clear Filters', listeners: [
                    { "click": function (evt, ui) {
                        $grid.pqGrid( "option", "filterModel", { on: false } );
                    }
                    }
                ]
                },

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: Clear Filters
« Reply #3 on: March 03, 2014, 11:13:35 am »
Method 1:

Call refreshDataAndView after setting on : false
Code: [Select]
$grid.pqGrid( "option", "filterModel", { on: false } );
 $grid.pqGrid( "refreshDataAndView" );

Method 2:

Code: [Select]
$grid.pqGrid( "filter", { oper:'replace', data: [] } );
« Last Edit: March 03, 2014, 11:15:38 am by paramquery »

angelahlp

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
Re: Clear Filters
« Reply #4 on: March 03, 2014, 12:38:49 pm »
Thanks! That last line did the trick!  :)