WidgetFunction
Namespace: Wisej.Web.Ext.Syncfusion
Assembly: Wisej.Web.Ext.Syncfusion (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.
Example:
The following example adds a function to the chart and calls it from the server.
this.chart1.WidgetFunctions = new[]
{
new ejBase.WidgetFunction
{
Name = "getSeriesCount",
Source = "return this.widget.model.series.length;"
}
};
// later, i.e. in the handler of a button.
var count = await this.chart1.CallAsync("getSeriesCount");
Constructors
WidgetFunction()
Initializes a new instance of WidgetFunction.
Properties
Name
String: Returns or sets the name of the WidgetFunction. (Default: "")
The name is used to call the function from the server, i.e. widget.Call("name"), and to refer to the function in the options of the widget, i.e. "()=>name". A function that has the same name of an existing function of the client side wrapper replaces it. Functions without a name are ignored.
Source
String: Returns or sets the JavaScript source code of the WidgetFunction.
The value is the body of the JavaScript function, without the function declaration. When the function is called from the server the arguments are available through the JavaScript arguments object. When the function is assigned to an option using the form "(a,b)=>name", the names in parentheses are the parameters of the function. Functions without source code are ignored.
Example:
var function = new ejBase.WidgetFunction();
function.Name = "selectRow";
function.Source = "this.widget.selectRows(arguments[0]);";
this.grid1.WidgetFunctions = new[] { function };
// later, i.e. in the handler of a button: selects the third row.
this.grid1.Call("selectRow", 2);