KnockoutTemplate Interface
In This Article
A template notation used to specify templates for UI component elements.
#Declaration
TypeScript
export interface KnockoutTemplate
#Remarks
The following code shows how to define and use a template. The template id is dx-save-as-form
:
js
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");
}
cshtml
<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
TypeScript
data?: any
#Property Value
Type |
---|
any |
#name Property
#Declaration
TypeScript
name: string
#Property Value
Type |
---|
string |