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

Custom List of Filter Functions for Custom Field Editor

14 Answers 325 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Campus Labs
Top achievements
Rank 1
Campus Labs asked on 01 Jun 2010, 03:54 PM
I've created a custom dropdown field editor as outlined in this post and everything works great. I'd like to change the list of filter functions for the editor. For instance, in the case of the dropdown editor, I only need a few options: equal to, not equal to, is null, is not null. How can I customize this list?

Please see the attached image where I've highlighted the area in the expression I'm talking about.

14 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 02 Jun 2010, 04:00 PM
Hi Ross,

Could you please check this help article and let me know if it helps in your case?

Best wishes,
Iana
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
Campus Labs
Top achievements
Rank 1
answered on 02 Jun 2010, 05:36 PM
Thanks for your reply, Iana. However, I don't see a link to a help article in your post. Could you please post the link to the article again?
0
Iana Tsolova
Telerik team
answered on 03 Jun 2010, 06:56 AM
Hi Ross,

Please excuse for the missing link. Here it is:
http://www.telerik.com/help/aspnet-ajax/filter-localization.html

Let me know if I can help you further.

Kind regards,
Iana
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
Campus Labs
Top achievements
Rank 1
answered on 04 Jun 2010, 02:24 PM
Hi Iana,

We've used the localization features to rename the filtering functions to more reader-friendly versions. However, we'd like to customize the items that appear in the list. For instance, in the first look demo for the RadFilter, that list is different for different fields in the filter. The OrderDate field doesn't contain some of the items (IsEmpty, NotIsEmpty, etc.) the ShipName field does. I'm assuming this is because those two fields use different field editors - presumably, the RadFilterTextFieldEditor and the RadFilterDateFieldEditor. I'd like to know how to customize that list for our custom field editor (which we modeled after the RadFilterComboBoxEditor in the post linked above).
0
Garth Hinkel
Top achievements
Rank 1
answered on 07 Jun 2010, 11:03 AM
Ross,

I need the same functionality as you have asked for.  Have you got anywhere with this?

Regards,

Garth
0
Iana Tsolova
Telerik team
answered on 07 Jun 2010, 02:53 PM
Hi,

What items will be displayed in the filtering menu for the particular editor depends on the DataType property of the editor. For instance if it is System.String, the filer menu would have an option Contains but if the DataType is Int32, it will not have a Contains option. And what the specific field editor determines is the type of the input field - CheckBox, TextBox, DatePicker or NumericTextBox for instance.

However, can you elaborate on the way you what to customize the filtering menu? Do you want to reduce its items or to add custom ones for custom filters handling?

Greetings,
Iana
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
Garth Hinkel
Top achievements
Rank 1
answered on 07 Jun 2010, 03:01 PM
Hi Iana,

Thanks for the reply.
I am aware of the functionality i.t.o datatype.
However I don't need all the options in the filtering menu, and would like to set them specifically for each custom filter I have built.

I imagine I would need to create custom ones in the near future too.

Look forward to your reply.

Garth
0
Campus Labs
Top achievements
Rank 1
answered on 09 Jun 2010, 05:22 PM
Iana,

Thanks for letting me know the field's data type determines the list of filter functions available. To answer your question, I would like to reduce the number of items in that list for the custom RadFilterComboBoxEditor I've built. The DataType of the editor is String. I've attached a list of the options currently available in the filter funtion list. I'd like to reduce that list to contain only 4 of the items: equal to, not equal to, is null, is not null.

Changing the list here for the RadFilterComboBoxEditor should not effect the default options for the RadFilterTextFieldEditor.
0
Accepted
Iana Tsolova
Telerik team
answered on 10 Jun 2010, 12:21 PM
Hi Ross,

To reduce the RadFilter filter menu items, you need to handle the menu OnShowing client-side event and set the odd items as invisible. You can find the filter menu in the OnFilterCreated client-side event handler:

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
    function FilterCreated(sender, eventArgs) {
        var filterMenu = sender.get_contextMenu();
        filterMenu.add_showing(FilterMenuShowing);
    }
    function FilterMenuShowing(sender, eventArgs) {
        var filter = $find("<%= RadFilter1.ClientID %>");
        var currentExpandedItem = sender.get_attributes()._data.ItemHierarchyIndex;
        if (filter._expressionItems[currentExpandedItem] == "ContactTitle") {
            sender.findItemByValue("IsNull").set_visible(false);
            sender.findItemByValue("NotIsNull").set_visible(false);
        }
        if (filter._expressionItems[currentExpandedItem] == "Country") {
            sender.findItemByValue("GreaterThan").set_visible(false);
            sender.findItemByValue("LessThan").set_visible(false);
        }
    }
</script>
</telerik:RadCodeBlock>

I am also attaching a runnable sample illustrating the suggested approach.

Best wishes,
Iana
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
Leo
Top achievements
Rank 1
answered on 04 Nov 2010, 12:18 PM
Hi Iana,

what about changing the default filter function?
For example: I'm using a RadFilterTextFieldEditor. His default filtering function is "Equal To". How can I change it to "Contains"?
So when the filter is loaded, it shows automatically "Contains" instead of "Equal To".

thanks in advance

Leonardo
0
Campus Labs
Top achievements
Rank 1
answered on 04 Nov 2010, 02:20 PM
Leonardo, I've asked the same question in another post and am still awaiting a response.
0
Iana Tsolova
Telerik team
answered on 09 Nov 2010, 02:46 PM
Hello,

Please find the sample project I attached to my post on the 5th of November in this thread.

Sincerely yours,
Iana
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
Paul Taylor
Top achievements
Rank 1
answered on 23 Aug 2011, 11:54 AM
How can I change the operators available for a custom FieldEditor on the server? I don't want to rely on javascript to do this.
0
Iana Tsolova
Telerik team
answered on 23 Aug 2011, 01:27 PM
Hi Paul,

This cannot be done server-side because the items which are displayed in the context menu are added client-side when the menu is about to show.

Kind regards,
Iana
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Filter
Asked by
Campus Labs
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Campus Labs
Top achievements
Rank 1
Garth Hinkel
Top achievements
Rank 1
Leo
Top achievements
Rank 1
Paul Taylor
Top achievements
Rank 1
Share this question
or