Custom List of Filter Functions for Custom Field Editor

15 posts, 1 answers
  1. Campus Labs
    Campus Labs avatar
    13 posts
    Member since:
    Jan 2007

    Posted 01 Jun 2010 Link to this post

    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.
  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 02 Jun 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Campus Labs
    Campus Labs avatar
    13 posts
    Member since:
    Jan 2007

    Posted 02 Jun 2010 Link to this post

    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?
  5. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 03 Jun 2010 Link to this post

    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.
  6. Campus Labs
    Campus Labs avatar
    13 posts
    Member since:
    Jan 2007

    Posted 04 Jun 2010 Link to this post

    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).
  7. Garth Hinkel
    Garth Hinkel avatar
    3 posts
    Member since:
    Sep 2009

    Posted 07 Jun 2010 Link to this post

    Ross,

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

    Regards,

    Garth
  8. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 07 Jun 2010 Link to this post

    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.
  9. Garth Hinkel
    Garth Hinkel avatar
    3 posts
    Member since:
    Sep 2009

    Posted 07 Jun 2010 Link to this post

    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
  10. Campus Labs
    Campus Labs avatar
    13 posts
    Member since:
    Jan 2007

    Posted 09 Jun 2010 Link to this post

    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.
  11. Answer
    Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 10 Jun 2010 Link to this post

    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.
  12. Leo
    Leo avatar
    20 posts
    Member since:
    Jul 2010

    Posted 04 Nov 2010 Link to this post

    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
  13. Campus Labs
    Campus Labs avatar
    13 posts
    Member since:
    Jan 2007

    Posted 04 Nov 2010 Link to this post

    Leonardo, I've asked the same question in another post and am still awaiting a response.
  14. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 09 Nov 2010 Link to this post

    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
  15. Paul Taylor
    Paul Taylor avatar
    41 posts
    Member since:
    Jun 2010

    Posted 23 Aug 2011 Link to this post

    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.
  16. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 23 Aug 2011 Link to this post

    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 >>

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017