Changing default filter no longer works

Posted by: stefan.brenner.a on 12 April 2018, 11:25 pm EST

    • Post Options:
    • Link

    Posted 12 April 2018, 11:25 pm EST

    Hi,

    I once asked how to change the default behavior of the FlexGrid filter. I didn’t want the default behavior of it showing the value filter but instead did want it to start in the conditions filter with the Contains filter as a default. I got some helpful sample code looking like this:

    this.gridFilter.filterChanging.addHandler((gridFilter: wjGridFilter.FlexGridFilter, e: any) => {

    var cf = gridFilter.getColumnFilter(e.col);

    if (!cf.valueFilter.isActive && cf.conditionFilter.condition1.operator == null) {

    cf.filterType = wjGridFilter.FilterType.Condition;

    cf.conditionFilter.condition1.operator = wjGridFilter.Operator.CT;

    }

    });

    This has worked fine with version 2017 of the Wijmo controls but since I updated to 5.20181.436 I’m running into problems. The code still executes but when the filter dialog is first shown it shows the value filter. Only when it is opened a second time will the changes have been applied.

    Can you please help me either with a bugfix or with some sample code on how to achieve the wanted behavior in the current version.

    Thanks and best regards.

  • Posted 15 April 2018, 7:23 pm EST

    For the simplicity FlexGridFilter now provides defaultFilter property to set the filter type.

    Please use it to set default filter types.

    //refer to following code snippet

    
    this.gridFilter.defaultFilterType=wjcGridFilter.FilterType.Condition;
    
    

    Here is an example of the same:-

    https://stackblitz.com/edit/angular-lfziyi?file=app%2Fapp.component.ts

  • Posted 19 April 2018, 8:07 pm EST

    Hi,

    thanks for the reply. This solves a part of the problem and would definitely be a nicer way of handling the default behavior if I can get it to work completely. Do you also have an option to set the default operator of the conditions filter to the Contains operator? Otherwise I’d still need some help to make this work as before.

    Thanks and best regards.

  • Posted 22 April 2018, 10:09 pm EST

    Hi,

    You can easily customize filter options shown by accessing cultures object.

    Please refer to the following example:-

    https://stackblitz.com/edit/angular-aekpfs?file=app/app.component.ts

    A list of available operators can be found here:- http://demos.wijmo.com/5/Angular/WijmoHelp/WijmoHelp/topic/wijmo.grid.filter.Operator.Enum.html

    ~Manish

  • Posted 23 April 2018, 7:34 pm EST

    Hi,

    I wanted to have the Contains filter on every column as a default but I managed with both your samples by iterating over each column when the collection is set. This seems to work fine - so the code to set the column filter has remained the same, just the time when to do it had to be changed with the update to the current version. So thanks for your support.

    BTW can you also see that the name of the poster of this thread has been changed to chris.karkowsky? I started the topic but this is not my user name - kind of strange.

    Thanks and best regards.

  • Posted 23 April 2018, 10:57 pm EST

    Hi Stefan,

    Apologies. I’m not sure how much you enjoyed being me, but I have reverted your username back to the way it should be :).

    Chris

Need extra support?

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

Learn More

Forum Channels