Skip to main content

KnockoutTemplate Interface

A template notation used to specify templates for UI component elements.

Declaration

export interface KnockoutTemplate

Remarks

The following code shows how to define and use a template. The template id is dx-save-as-form:

View Example

function SaveAsDashboardExtension(dashboardControl) {
    this._dashboardControl = dashboardControl;
    this._menuItem = {
        id: "dashboard-save-as",
        title: "Save As...",
        template: "dx-save-as-form",
        selected: ko.observable(true),
        disabled: ko.computed(function () { return !dashboardControl.dashboard(); }),
        index: 112,
        data: this
    };
    this.newName = ko.observable("New Dashboard Name");
}
<script type="text/html" id="dx-save-as-form">
    <div>Dashboard Name:</div>
    <div style="margin: 10px 0" data-bind="dxTextBox: { value: newName }"></div>
    <div data-bind="dxButton: { text: 'Save', onClick: saveAs }"></div>
</script>

Properties

data Property

Declaration

data?: any

Property Value

Type
any

name Property

Declaration

name: string

Property Value

Type
string