Skip to main content

WidgetTemplate

Namespace: Wisej.Web.Ext.Syncfusion

Assembly: Wisej.Web.Ext.Syncfusion (4.1.0.0)

Represents a Syncfusion template.

public class WidgetTemplate

Templates in the Syncfusion library are either plain global JavaScript functions, or HTML snippets using their template syntax.

Example:

The following example registers a JsRender template and uses it as the template of a grid column.

this.grid1.WidgetTemplates = new[]
{
new ejBase.WidgetTemplate
{
Id = "nameTemplate",
Template = "<b>{{:LastName}}</b>, {{:FirstName}}"
}
};
this.grid1.Options.columns = new object[]
{
new { headerText = "Name", template = "#nameTemplate" }
};

Constructors​

Instance member WidgetTemplate()​

Initializes a new instance of WidgetTemplate.

Properties​

Instance member Id​

String: Returns or sets the identifier of the WidgetTemplate. (Default: "")

The identifier is assigned to the id attribute of the <script> element created in the browser and must be unique in the page. Use it in the options of the widget as #id. Templates without an identifier are ignored.

Instance member Template​

String: Returns or sets the content of the WidgetTemplate. (Default: "")

The content is placed inside the <script> element created in the browser. With the default Type it is an HTML snippet that uses the JsRender syntax, i.e. {{:FieldName}}. Templates without content are ignored.

Example:

var template = new ejBase.WidgetTemplate();
template.Id = "nameTemplate";
template.Template = "<b>{{:LastName}}</b>, {{:FirstName}}";

Instance member Type​

String: Returns or sets the type of the template. Use "text/x-jsrender" for HTML templates. (Default: "text/x-jsrender")

The value is assigned to the type attribute of the <script> element created in the browser. The default is text/x-jsrender, which is also used when the value is empty.