Duplicate Filters

4 posts, 0 answers
  1. Hadrien
    Hadrien avatar
    28 posts
    Member since:
    Apr 2012

    Posted 21 May 2014 Link to this post

    Hi,

    I have a Date field which I split in three columns:

                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding StartDate, StringFormat='yyyy'}" Header="Year"/>
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding StartDate, StringFormat='MMM'}" Header="Month"/>
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding StartDate, StringFormat='dd'}" Header="Day"/>

    Happens that when I try to filter the rows via the GridView filters I get duplicate entries there:


    Is there a way to remove those duplicates?

    Thanks
  2. Boris
    Admin
    Boris avatar
    276 posts

    Posted 26 May 2014 Link to this post

    Hello Hadrien,

    I'm not sure what you mean by: I try to filter the rows via the GridView filters I get duplicate entries there.
    The distinct values that you see in the top half of the Popup filtering dialog are produced in the following way. The actual raw value is taken, it is passed through the Binding Converter if any exist, the result is then string.Format-ed if there is a string format. The final result is shown in the distinct values list-box. But that is just a label -- it is not the real actual raw value. It is a string representation of it. So if the user has specified a 'yyyy' string format, he will see "1992", but when he clicks it, the underlying filter will use the DateTime '11-Jan-92 00:00:00' and not the string "1992".

    In order to reproduce and understand your case better could you please provide us with more details? For example you can send us some pictures or screen-cast that illustrate the issue or modify the attached sample project?

    Thank you in advance for your cooperation.

    Regards,
    Boris Penev
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. Hadrien
    Hadrien avatar
    28 posts
    Member since:
    Apr 2012

    Posted 26 May 2014 in reply to Boris Link to this post

    Hi Boris,

    So what I meant by "I try to filter the rows via the GridView filters I get duplicate entries there" is that I want to see the rows where one of the columns = X.
    In my case, every row in the GridView has a City, Country and a Year, Month and Day. I want to get the rows where month is May, but when I click on the Month column filter I get duplicate entries for May when I was expecting to get just one and if selected it I would get the rows I want.

    See the attached image which shows what is happening.

    Thanks

  4. Boris
    Admin
    Boris avatar
    276 posts

    Posted 28 May 2014 Link to this post

    Hello Hadrien,

    One of the easiest ways to remove these duplicates is to edit your business object in a way that it has different properties for year, month and day. 

    I attached a sample project that demonstrates the suggested approach.

    I hope this helps.

    Regards,
    Boris Penev
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top