FlexGrid Default Filter type to Condition while keeping Value available

Posted by: malpacasville on 17 September 2020, 3:36 am EST

    • Post Options:
    • Link

    Posted 17 September 2020, 3:36 am EST

    How can I change the filter type to default to condition while keeping the value filter available?

    I know I can change the filter type to condition like the code below from the example in the filterChanging documentation.

    But if I do this I lose the “Filter by Condition | Filter by Value” links to change between the two.

    
    self.Grid.Filter().filterChanging.addHandler(function (s, e)
    {
       var cf = self.Grid.Filter().getColumnFilter(e.col);
       if (!cf.valueFilter.isActive && cf.conditionFilter.condition1.operator == null)
       {
          cf.filterType = wijmo.grid.filter.FilterType.Condition;
          cf.conditionFilter.condition1.operator = wijmo.grid.filter.Operator.CT;
       }
    });
    
    
  • Posted 17 September 2020, 8:35 pm EST

    We’ve monkey patched the prototype._showFilter to get around this for anyone with the same problem.

    
    let _showFilter = wijmo.grid.filter.ColumnFilterEditor.prototype._showFilter;
    wijmo.grid.filter.ColumnFilterEditor.prototype._showFilter = function (e)
    {
       if (!this.hostElement.classList.contains('wj-state-focused')) arguments[0] = wijmo.grid.filter.FilterType.Condition;
       
       _showFilter.apply(this, arguments);
    };
    
    
  • Posted 18 September 2020, 12:15 am EST

    Hi,

    We are glad that you were able to find a solution to your requirements. But the _showFilter method is a private method and there is a possibility that it may be removed in future releases. So, we would recommend you use the filterChanging event of the FlexGridFilter and manually display the condition filter by clicking on the Filter By Condition link. Please refer to the sample link below for reference:

    https://stackblitz.com/edit/js-myglmx

    Regards,

    Ashwin

Need extra support?

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

Learn More

Forum Channels