Is there a way to create a new type of filter, or extend ValueFilter somehow?

Posted by: egor.kachiguine on 14 January 2019, 12:01 pm EST

    • Post Options:
    • Link

    Posted 14 January 2019, 12:01 pm EST

    The scenario we need doesn’t seem to be possible, but it also seems relatively standard. Basically, we’d like to have a list of status flags that are allowed and not. The existing design has two problems - it only displays values that are found in the collection already, but we need it to be “all possible values”. This part can be gotten around by extending the ColumnFilterEditorclass, and doing some surprisingly non-trivial workarounds in the AddValueCheckBox method. So far so good. You can even load them into the filter via the XML load function.

    But as soon as a user unchecks one of the selected flags, the “selected by not present” flags will disappear. The class checks the selections against its internal dictionary, and the value filter only gets the flags that exist in the collection, not all of them. And there is no way to get at the list of selected/unselected items from the editor closing method, so we can’t even store them for next time or refresh the filter with the XML containing additional values. Thus next time the filter is opened, flags that are not found are unselected, and since the filter is now active, new items with those flags will be filtered out.

    Any tips?

  • Posted 15 January 2019, 5:03 pm EST

    Hi,

    We are discussing this case with the developers and will let you know as soon as they suggest something. (TSF ID: 362352)

    Thanks,

    Basant

  • Posted 16 January 2019, 6:01 pm EST

    Hello,

    As per the development team this is the intended behavior to collect values for ValueFilter from the original column values.

    However, they suggest that you can add some temporary data in your source to cause Values for them in Value Filter and then hide the rows for these data items.

    
    // Add rows for additional filtering values.
    dt.Rows.Add(new object[] { null, null, "Others", null });
    ..........
    //Hide additional rows
    flexGridFilter.FilterApplied += (sender, args) =>
    {
     _flex.Rows.Where(x => x.DataItem == tempItem).FirstOrDefault().Visible = false;
    };
    
    

    Please refer the attached sample(prj_ValueFilterValues.zip) for the same.

    Thanks,

    Basant

    prj_ValueFilterValues.zip

  • Posted 17 January 2019, 9:59 am EST

    Interesting, we’ll play around with this approach, see if we can make it work.

    Thanks!

Need extra support?

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

Learn More

Forum Channels