WidgetFunction
Namespace: Wisej.Web.Ext.DevExtreme
Assembly: Wisej.Web.Ext.DevExtreme (4.1.0.0)
Represents a JavaScript function attached to the widget on the browser.
- C#
- VB.NET
public class WidgetFunction
Public Class WidgetFunction
Refer to "this" in the context of the function to target the wisej.web.Widget instance, and to "this.widget" to refer to the third party widget.
Constructors
WidgetFunction()
Initializes a new instance of WidgetFunction.
Properties
Name
String: Returns or sets the name of the WidgetFunction. (Default: "")
The name identifies the function when it is invoked from the server and when it is referenced in the options of the widget. See WidgetFunctions. A null value is converted to an empty string.
Source
String: Returns or sets the JavaScript source code of the WidgetFunction.
The value is the body of the function, without the function declaration. When the function is referenced in an option as "(arg1,arg2)=>name", the body can use the argument names declared in the option; otherwise the values received by the function are available in arguments. A null value is converted to an empty string.
Example:
The following example defines a function that returns the text displayed in the tooltip of a chart and assigns it to the customizeTooltip option.
var formatter = new dxBase.WidgetFunction();
formatter.Name = "formatTooltip";
formatter.Source = "return { text: info.argumentText + ': ' + info.valueText };";
this.dxChart1.WidgetFunctions = new[] { formatter };
this.dxChart1.Options.tooltip = new { enabled = true, customizeTooltip = "(info)=>formatTooltip" };