How to remove values from filter

5 posts, 0 answers
  1. Praveen
    Praveen avatar
    3 posts
    Member since:
    Nov 2015

    Posted 23 Nov 2015 Link to this post

    Hi, 

    I'm using a RadGridView which has many columns of type GridViewComboBoxColumn. "IsFilteringAllowed" is set to true. I've some columns which is binded to enums. Hence, when the grid in rendered, its picking the filter options from the enum. Since its nullable enum, the filter option contains "null" and blank entry. I'm trying to remove them. I'd searched and explored a lot in internet including Telerik forums, but didn't find the right way yet. 

    Could someone throw some light in the right direction to solve this?

    public enum TestEnum
        {
            One = 0,
            Two,
            Three,
        }
    ....
    ....
    private TestEnum? _objTest;
    public TestEnum? sampleTest
            {
                get
                {
                    return _objTest;
                }
            }
    ...
    ...
    <telerik:GridViewComboBoxColumn x:Name="TESTING"     DataMemberBinding="{Binding sampleTest}"        Header="{Binding Path=Sequence,  Source={StaticResource DCTResources}}" TextAlignment="Center" Width="28" IsReadOnly="True" IsVisible="{Binding IsVisible}" ShowDistinctFilters="True" />
    ...
    ...
    Resulting filter contains values: (blank), null, One, Two, Three
     

     

    Regards,

    Praveen.

  2. Praveen
    Praveen avatar
    3 posts
    Member since:
    Nov 2015

    Posted 25 Nov 2015 in reply to Praveen Link to this post

    Update:

     http://docs.telerik.com/devtools/silverlight/controls/radgridview/filtering/how-to/howto-customize-the-default-field-filter-editor.html

    As per above article, i was able to hook up to the filter values (in fact its called filter editor) and view the list. BUT, when we try to remove the items which we wanted to remove, we get exception "Operation is not valid while ItemsSource is in use. Access and modify elements with ItemsControl.ItemsSource instead"

     The reason being we are trying to modify the items which is bound to UI, as explained in below article. 

     http://stackoverflow.com/questions/11089104/operation-is-not-valid-while-itemssource-is-in-use-access-and-modify-elements-w

     

    It seems its not possible to achieve the desired result. 

     

    Just curious, is there a way to bind a grid column to two properties - one for actual item source to display values, and another one for binding to filter editor? Currently for filter editor, it picks the values from the same property which we had bound for item source. 

     

    Regards,

    Praveen

     

     

     

  3. DevCraft banner
  4. Stefan X1
    Admin
    Stefan X1 avatar
    523 posts

    Posted 26 Nov 2015 Link to this post

    Hello Praveen,

    I am afraid that as you have already found, the requirement from your first post would not be possible, as the filtering is a data operation and is performed over the underlying collection bound to the ItemsSource property of RadGridView.

    As to your second requirement, there is a built-in mechanism that you can benefit from - the FilterMemberPath property of GridViewDataColumn. Basically, through it you can point to a property different from the displayed one.

    Can you please give it a try and let me know how it goes?

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. Praveen
    Praveen avatar
    3 posts
    Member since:
    Nov 2015

    Posted 01 Dec 2015 in reply to Stefan X1 Link to this post

    Hi Stefan, 

    Thanks for your reply. 

    We got held up with another task. I will post my results once I try the above suggestion. 

    Regards,

    Praveen

  6. Stefan X1
    Admin
    Stefan X1 avatar
    523 posts

    Posted 04 Dec 2015 Link to this post

    Hi Praveen,

    Feel free to write back when you have an update on the suggested approach. I will be happy to help in case you need further assistance.

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner