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

Converters with DataFilters

2 Answers 106 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Doug
Top achievements
Rank 1
Doug asked on 26 May 2011, 03:22 PM
Hi,

I have a values stored for a property in bytes within the database and then present these values to the user in Mb by use of a converter on that field in a RadGridView. I have a RadDataFilter attached to the grid with one of the options for filtering the grid being this field.

Unfortunately when the user types in a value that he wants to filter on he will do do it in what he thinks is sensible i.e. Mb (as that is what he sees) but the filter is working as if its still bytes and not giving in the expected results.

I'm sure there must be a simple way around this but i'm struggling...

I'm using item property definitions for the filtering as below in the xaml.

Please can you help.

Thanks
Doug

 
<telerik:RadDataFilter x:Name="radDataFilter" Source="{Binding Items, ElementName=SearchGrid}" AutoGenerateItemPropertyDefinitions="False" <br>                            CanUserCreateCompositeFilters="True"><br>                            <telerik:RadDataFilter.ItemPropertyDefinitions><br>                                <dataFilter:ItemPropertyDefinition PropertyName="ProjectName" PropertyType="{Binding String, Source={StaticResource Types}}" DisplayName="Project name"/><br>                                <dataFilter:ItemPropertyDefinition PropertyName="DataName" PropertyType="{Binding String, Source={StaticResource Types}}" DisplayName="Data name"/><br>                                <dataFilter:ItemPropertyDefinition PropertyName="DataType" PropertyType="{Binding String, Source={StaticResource Types}}" DisplayName="Data type"/><br>                                <dataFilter:ItemPropertyDefinition PropertyName="FileSize" PropertyType="{Binding Int64, Source={StaticResource Types}}"  DisplayName="File size"/><br>                                <dataFilter:ItemPropertyDefinition PropertyName="Path" PropertyType="{Binding String, Source={StaticResource Types}}" DisplayName="Path"/><br>                            </telerik:RadDataFilter.ItemPropertyDefinitions><br>                        </telerik:RadDataFilter>

2 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 26 May 2011, 03:51 PM
Hi Doug,

Why don't you add a read-only property on your business object that will return the size in Mb (i.e. divide the bytes one by (1024*1024)) instead of bytes. Then filter on this Mb property instead of the other one. You will solve all of your problems with only several lines of code.

The thing is, that filtering is always performed over the actual real data.

I hope this helps.

Kind regards,
Ross
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Doug
Top achievements
Rank 1
answered on 26 May 2011, 03:58 PM
Thanks for the prompt response.

Good idea, I'll do that instead. I didn't know whether there was another converter type option to get around it. I have quite a few such fields all over the place but it't not a massive overhead.

Thanks
Doug
Tags
DataFilter
Asked by
Doug
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Doug
Top achievements
Rank 1
Share this question
or