Converters with DataFilters

3 posts, 0 answers
  1. Doug
    Doug avatar
    15 posts
    Member since:
    Feb 2011

    Posted 26 May 2011 Link to this post

    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. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 26 May 2011 Link to this post

    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
  3. DevCraft banner
  4. Doug
    Doug avatar
    15 posts
    Member since:
    Feb 2011

    Posted 26 May 2011 Link to this post

    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
Back to Top