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

How to filter column which is binded to the indexed property?

4 Answers 77 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Valdo
Top achievements
Rank 1
Valdo asked on 25 Mar 2011, 05:02 PM
The ItemSource of my grid is a List<ComplexObject> and ComplexObject contains a Dictionary<int, object> ComplexList. So I'm creating columns in runtime where DataMemberBinding is 
{Binding ComplexList, Converter={StaticResource IndexedConverter},
ConverterParameter=index }

I managed to implement custom sorting but I have no clue on how to make filter work. I know that it doesn't work, when Converter is used, but I hope that there could be a workaround. Any other ideas on how to display values and make them filterable/sortable would be also very appreciated.

4 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 28 Mar 2011, 08:57 AM
Hi Valdo,

This sounds strange since the Filtering Control should respect the IValueConverter.

I guess that you are not seeing the filtering funnel because the data type of the column is not known and filtering is disabled when the type is unknown.

Maybe you should specify the DataType of the column in order to enable filtering.

Kind regards,
Ross
the Telerik team
0
Valdo
Top achievements
Rank 1
answered on 28 Mar 2011, 09:28 AM

Well, actually you are right, it thinks that the type is "object" when in fact GetType() returns "string". I've made a custom filter which is almost the same as default. I set DataType = typeof(string) for the column explicit and MemberType = typeof(String) for the FilterDescriptor and it works fine. But I want more generic solution. Is there any way to do this?

Update: i think the reason of this behavior is that the filter using Path=ComplexList and not ComplexList[i]. So even if i specify DataType explicitly it won't work. 

0
Accepted
Rossen Hristov
Telerik team
answered on 28 Mar 2011, 11:53 AM
Hello Valdo,

The custom filtering control functionality was created just for cases like yours -- when you need custom filtering. We can't cover all possible custom filtering requirements with the stock filtering control, that's why we created this feature.

Greetings,
Ross
the Telerik team
0
Valdo
Top achievements
Rank 1
answered on 28 Mar 2011, 12:08 PM
In that case I'm glad I could achieve what I was needed with Custom Filter. 
Tags
GridView
Asked by
Valdo
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Valdo
Top achievements
Rank 1
Share this question
or