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

RadFilter how to increase the filter menu options by column

5 Answers 67 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Vijendra
Top achievements
Rank 1
Vijendra asked on 24 Dec 2014, 12:47 PM
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? .

5 Answers, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 26 Dec 2014, 09:40 AM
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.

 
0
Vijendra
Top achievements
Rank 1
answered on 26 Dec 2014, 09:55 AM
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
0
Ianko
Telerik team
answered on 26 Dec 2014, 11:50 AM

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.

 
0
Vijendra
Top achievements
Rank 1
answered on 26 Dec 2014, 12:10 PM
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.
0
Ianko
Telerik team
answered on 26 Dec 2014, 01:06 PM
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.

 
Tags
General Discussions
Asked by
Vijendra
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Vijendra
Top achievements
Rank 1
Share this question
or