FlexGridFilter .filterChanged doesn't proc with FilterPanel filters clearing

Posted by: chifret on 16 November 2017, 10:16 pm EST

    • Post Options:
    • Link

    Posted 16 November 2017, 10:16 pm EST

    Hi,

    I’m keeping track of grid’s filters by using the filterChanged event

    filter.filterChanged.addHandler(() => {
        // code here
    }
    

    It works fine when I change them by using the funnel icon in the column header. Adding, changing, removing, everything is OK.

    However, when I interact with them through the FilterPanel component (so, only the “clear all filter” + every filters buttons), the event doesn’t trigger.

    I don’t get why ; even from another source, the filter HAS changed.

    Could you statue on this ?

    If there is another way to deal with that, what could it be ?

    Thanks in advance !

  • Posted 19 November 2017, 8:33 pm EST

    Hi,

    Since the FlexGridFilter filterChanged event is not called when we removing the filter items from Filter panel, filterChanged event does not get triggered.

    We have forwarded this request to the concerned team for further investigation. This may be fixed in the future.

    As a workaround, you need to made changes in FilterPanel.js file. Please update the following code snippet:

    // remove filter on click
                  FilterPanel.prototype._click = function (e) {
                      var target = e.target;
                      if (target.classList.contains('wj-remove')) {
                          var marker = wijmo.closest(target, '.wj-filtermarker'), filter = marker ? marker['filter'] : null;
                          if (filter instanceof filter_1.ColumnFilter) {
                              filter.clear();                            
                              this._filter.apply();                            
                              this._filter.onFilterChanged(new wijmo.grid.CellRangeEventArgs(this._filter.grid.cells, new wijmo.grid.CellRange(-1, filter.column.index, -1, filter.column.index)));
                              
                          }
                          else {
                              this._filter.clear();
                              this._filter.onFilterChanged(new wijmo.grid.CellRangeEventArgs(this._filter.grid.cells, new wijmo.grid.CellRange(-1, -1, -1, -1)));
                          }
                      }
                  };
    

    ~Manish

  • Posted 20 November 2017, 8:13 am EST

    Hi Manish

    http://jsfiddle.net/h1njyaez/78/

    I want the filter to be applied on the Country column where the filter select check boxes would be US and UK when we load the grid

    an

    as you can see in the screenshot the filter should apply to the country column by default US & UK to be selected and the other values unchecked

  • Posted 20 November 2017, 6:21 pm EST

    Hi Waheed,

    You need to set filterDefinition for the same. Please refer to the updated fiddle for the same:

    http://jsfiddle.net/h1njyaez/79/

    ~Manish

  • Posted 20 November 2017, 11:25 pm EST

    Thanks Manish,

    But the filter icon on the column is not active even after the filtering.

    I am using the following snippet in my implementation

    var f = new wijmo.grid.filter.FlexGridFilter(flex);

    f.filterDefinition=‘{“defaultFilterType”:3,“filters”:[{“binding”:“country”,“type”:“value”,“filterText”:“”,“showValues”:{“UK”:true,“US”:true, “Italy”:true}}]}’;

    Is there any way to set the icon active?

    Thanks… Waheed

  • Posted 21 November 2017, 12:37 am EST

    Found the issue and resolved it … thanks Manish.

  • Posted 23 November 2017, 10:24 pm EST

    Thanks Manish, it works perfectly.

  • Posted 5 January 2018, 8:31 pm EST

    Hi All,

    This issue has been found fixed with pre-release build version 5.20173.400. If you would like to verify the issue, you may download the pre-release build for testing purpose.

    http://prerelease.componentone.com/wijmo5/

    This build is not recommended to use for production since this is under QA process for next release.

    ~Manish

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels