This is a migrated thread and some comments may be shown as answers.

Duplicate Filters

3 Answers 24 Views
This is a migrated thread and some comments may be shown as answers.
Hadrien
Top achievements
Rank 1
Hadrien asked on 21 May 2014, 12:42 PM
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

3 Answers, 1 is accepted

Sort by
0
Boris
Telerik team
answered on 26 May 2014, 09:16 AM
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.
 
0
Hadrien
Top achievements
Rank 1
answered on 26 May 2014, 10:13 AM
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

0
Boris
Telerik team
answered on 28 May 2014, 04:10 PM
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.
 
Asked by
Hadrien
Top achievements
Rank 1
Answers by
Boris
Telerik team
Hadrien
Top achievements
Rank 1
Share this question
or