Operators for DataFilter

4 posts, 0 answers
  1. Lori
    Lori avatar
    2 posts
    Member since:
    May 2012

    Posted 16 Jul 2014 Link to this post

    My datafilter displays the IsNull and IsNotNull operator for anything defined as a type = string.   My users would like these to show up under the operator drop down when they selected a value that is defined as a int32.   

    I found this in telerik documentation and it looks like these should appear for any filter type:

    When choosing the Operator, you have to make sure that the respective MemberType supports this operator. For example, you cannot use the Contains operator if your MemberType is Int32 because the data engine will crash. Here is a table of filter operators and the types that support them.
    Filter Operators and Types Supporting Them


    Operators                                                                                                                                                                      Types


    IsEqualTo, IsNotEqualTo                                                                                                                                               All filterable types

    StartsWith, EndsWith, Contains, DoesNotContain, IsContainedIn, IsNotContainedIn, IsEmpty, IsNotEmpty    String

    IsLessThan, IsLessThanOrEqualTo, IsGreaterThan, IsGreaterThanOrEqualTo                                                     Numeric types, DateTime, TimeSpan, all types
                                                                                                                                                                                             that overload these .Net operators

    IsNull, IsNotNull                                                                                                                                                                All filterable types
     
     I noticed that in the telerik demos for datafilter the IsNull and IsNotNull operators only show for strings.   Is it possible to add these to the operator dropdown for anything defined as a numeric value?

    Thanks,

    Lori
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 17 Jul 2014 Link to this post

    Hello Lori,

    If your data is of type null-able Int32, etc. then the IsNull and IsNotNull operators will be presented. Otherwise, it is not possible to have any null values, so you do not need those operators.

    Thank you for your note, I will update the text in the documentation to avoid any misunderstanding.

    Regards,
    Didie
    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. DevCraft banner
  4. Lori
    Lori avatar
    2 posts
    Member since:
    May 2012

    Posted 18 Jul 2014 Link to this post

    I am not using the data filter in a grid, I was referring to a raddatafilter.  I am using the raddatafilter to build a select statement to query a table from an external source.    I have a table containing available columns, these are defined as strings, int32, and date.   When a column is selected that is an int32, I wanted to have the IsNull and IsNotNull operators show up so that I can correctly build my sql.   There are null values in the numeric field in the external customers table.  
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 18 Jul 2014 Link to this post

    Hello Lori,

    In that case, I can suggest you adding a generic filter descriptor (FilterDescriptor<T>) to build the proper LINQ query to filter on manunally.

    You can check the Use generic FilterDescriptor documentation for an example on how to do so. The article is for RadGridView, however, the same logic applies for RadDataFilter.

    Regards,
    Didie
    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