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

How to add a custom function to the expression editor

1 Answer 169 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 29 Sep 2014, 07:07 PM
I am able to add a custom function no problem, however; doing so seems to remove all the default functions (see screenshot). Any ideas on how to add a custom function and leave the default functions as well?

Telerik.Data.Expressions.ExpressionContext.Context = new MyExpressionContext();
Telerik.WinControls.UI.RadExpressionEditorForm.ExpressionItemsList.Add(
    new Telerik.Data.Expressions.ExpressionItem
{
    Name = "MarketDate (Endur)",
    Value = "MarketDate()",
    Syntax = "MarketDate()",
    Type = Telerik.Data.Expressions.ExpressionItemType.OtherFunc,
    Description = "Returns the market date as it appears in the market manager."
});

Using the LoadFromXml function as described in the help has the same results.

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 30 Sep 2014, 01:34 PM
Hi Chris,

Thank you for writing.

By default if you add custom item the default ones are not added. To load them you should call the LoadFromXML method with no parameter:
RadExpressionEditorForm.ExpressionItemsList.LoadFromXML();
RadExpressionEditorForm.ExpressionItemsList.Add(item);

Please let me know if there is something else I can help you with. 
 
Regards,
Dimitar
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Chris
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or