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

Customise Filter Expression Text

4 Answers 84 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Fergal
Top achievements
Rank 1
Fergal asked on 13 Feb 2013, 09:37 AM
Is it possible to edit the display text for the RadFilter Expressions? For instance, on the RadFilter, you see an Expression for "StartsWith" - is it possible to edit that text (to enter a space for example: "Starts With"), but not actually change the functionality of the expression object?

I don't want to have to implement my own set of expressions, just alter the display text of the items already there.

Thanks
Fergal

4 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 13 Feb 2013, 11:52 AM
Hi,

Try setting the following.
aspx:
<telerik:RadFilter ID="RadFilter" runat="server" Localization-FilterFunctionStartsWith="Starts with"></telerik:RadFilter>

Thanks,
Shinu
0
Fergal
Top achievements
Rank 1
answered on 13 Feb 2013, 12:25 PM
Looks like exactly the feature I wanted, thanks!
0
Fergal
Top achievements
Rank 1
answered on 14 Feb 2013, 11:08 AM
Next Question: Can I change the text in the Expression Preview?

For example, I've changed "IsNull" to display "IsPresent" - I'd like to write that out in the Expression Preview in a user readable format that matches the display text.
0
Angel Petrov
Telerik team
answered on 18 Feb 2013, 08:50 AM
Hello Fergal,

In order to achieve this you can use this code snippet:
function pageLoad(sender, args)
        {
            var filter = $find("<%=RadFilter1.ClientID %>");
            var menu = filter.get_contextMenu();
            menu.add_showing(FilterMenuShowing);
 
            var elements = document.getElementsByTagName("a");
            for (var i = 0; i < elements.length; i++)
            {
                if (elements[i].className && elements[i].className.indexOf("rfExp") != -1 &&
                    elements[i].innerHTML == "IsNull")
                {
                    elements[i].innerHTML = "IsPresent";
                }
            }
        }
 
        function FilterMenuShowing(sender, args)
        {
           sender.findItemByValue("IsNull").set_text("IsPresent");
        }

In the example provided the IsNull value is replaced both in the field editor and in the context menu.

All the best,
Angel Petrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Filter
Asked by
Fergal
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Fergal
Top achievements
Rank 1
Angel Petrov
Telerik team
Share this question
or