RadFilter how to increase the filter menu options by column

6 posts, 0 answers
  1. Vijendra
    Vijendra avatar
    13 posts
    Member since:
    Jul 2014

    Posted 24 Dec 2014 Link to this post

    Hi,

    I want to add two or more filter options to the predefined set of filter options for a data type.

    For example I want to add "Is Empty" filter option to Int data type's predefined set of filter options which consists{Equal To, Not Equal To, Greater Than, Less Than, Greater Than Or Equal To, Less Than Or Equal To, Between, Not Between, Is Null, Not Is Null}.

    I tried doing this, by setting sender.findItemByValue("IsEmpty").set_visible(true) I am able to show "Is Empty " filter option in the menu ; but it also gets displayed in the  Field menu of the Rad filter. Can you please provide a solution for this issue? .
  2. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 26 Dec 2014 Link to this post

    Hi Vijendra,

    The built-in IsEmpty expression is designed to work only with System.String type and even if one is visually enabled for Int type there is no guaranty that it will work properly. 

    Why not using the IsNull expression? Note that when an empty string is converted to Int, the result is Null, not an empty string.

    Regards,
    Ianko
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Vijendra
    Vijendra avatar
    13 posts
    Member since:
    Jul 2014

    Posted 26 Dec 2014 in reply to Ianko Link to this post

    Thanks for the reply. Let me be more specific.

    I want to filter by Starts with, Ends with, contains, Does not contain for a integer.

    When I try to set the visibility of the item to true by using the command - set_visible, then its shown in both the data field column and data filter column.

    Let me know how to add Starts with, Ends with, contains, Does not contain as filter option in the integer filter
  4. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 26 Dec 2014 Link to this post

    Hi Vijendra,

    The mentioned expressions are only applicable with string values. The Numeric values cannot be processed with these expressions.

    How could a Number be checked if starts with a certain number, or be processed by any of the mentioned operations?

    Such logic is not available built-in in the .NET Framework, these are rather mathematical solutions that should be custom implementations. RadFilter cannot include such options and they are not applicable in the scope of the use-case scenarios of the control.

    If you are interested in creating custom Filter Expressions which to implement the desired logic, I suggest following these help articles:


    Regards,

    Ianko
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  5. Vijendra
    Vijendra avatar
    13 posts
    Member since:
    Jul 2014

    Posted 26 Dec 2014 in reply to Ianko Link to this post

    Hi,

    Please let me know how to set the visibility of the item to true by using the command - set_visible, without showing in both the data field column and data filter column.

    All the sample provided are directing to set_visible to false, set_visible to true is not working as expected.
  6. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 26 Dec 2014 Link to this post

    Hi Vijendra,

    The used set_visible method is exposed by the RadMenu control that serves the context menu of the RadFilter. Due to that, there is no programmatic approach with which to indicate that the opened context menu is assigned to a Numeric data or any other data field, and thus there is no applicable approach to enable the desired option only for a desired case.

    You can possibly implement a logic to capture if an expression is vissible and indicate that expression's context menu is opened, although I cannot guarantee that it is a reliable approach.
    <telerik:RadFilter runat="server" ID="RadFilter1">
        <ClientSettings ClientEvents-OnMenuShown="OnMenuShown"></ClientSettings>
    </telerik:RadFilter>
     
    <script>
        function OnMenuShown(sender, args) {
            var contextMenu = args.get_menu();
            var isNullItem = contextMenu.findItemByText("IsNull");
            var isEmptyItem = contextMenu.findItemByText("IsEmpty");
             
            isEmptyItem.set_visible(isNullItem.get_visible());
             
        }
    </script>

    Also, as already mentioned, enabling this menu item does not provide a built-in support for this option with Numeric values. 

    Regards,
    Ianko
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top