Interface CustomWidgetTemplate

Allows the inclusion of other widgets in a dialog template. The dialog will call onBuild when the widget's DOM element(s) structure should be constructed, onAdd when it is added to the document, onUpdate when properties in the widget should be copied to the element(s), beforeRemove and when they will be removed.

Hierarchy

Index

Properties

Optional beforeRemove

beforeRemove: function

If defined, this function will be called just before elements that represent the control have been added to the document tree.

Type declaration

Optional chain

chain: boolean

If true, this control will not appear on its own line but will instead be appended to the previously declared control. Multiple controls can be chained in sequence to combine them into one long row. When true, the control's label property has no effect.

Optional customType

customType: string

This can be set to differentiate amongst multiple custom widgets; it is ignored by the API.

Optional disabled

disabled: boolean

If true, the control will be disabled and the user will not be able to interact with it or change its value.

Optional element

element: HTMLElement

This must be set to the DOM element that best represents the control. It does not have to represent the root of the widget structure; that is determined automatically.

Optional id

id: string

If defined, this control can be looked up from the template's controls array using this value. It must conform to the regular expression /^[A-Za-z][\w\-\:\.]*$/.

Optional initialFocus

initialFocus: boolean

If true, this control will be given focus when the dialog is shown. Default is false.

Optional label

label: string

If defined, this text will be used as a label for the control.

Optional Readonly labelElement

labelElement: HTMLLabelElement

If the control has a label that appears in the dialog, this will point to the DOM element responsible for the label. This property is set by the interface framework and should be considered read only.

Optional onAdd

onAdd: function

If defined, this function will be called once elements that represent the control have been added to the document tree.

Type declaration

onBuild

onBuild: function

Called when the DOM structure that implements the control should be created. This function is responsible for setting the element property to the DOM element that represents the control. The element must not be placed in the document. If the control is interactive, then appropriate listeners should be hooked up that copy user changes to the control to the relevant properties of the template and then invoke the template's onUse function, if defined. Note that a call to onBuild is always be followed by a call to onUpdate.

see

onAdd

see

onUpdate

Type declaration

onUpdate

onUpdate: function

Called when the DOM structure that implements the control should be updated to reflect properties that can be set from the template. This is always called after the control is built and before it is added to the document. It is also called when an onUse handler returns false.

Type declaration

Optional onUse

onUse: function

If defined, this function will be called whenever the user changes the control's value. If the function makes changes to the template state (changing label text, disabled state, and so on), those changes will be propagated to the actual dialog. If changes are made to the structure of the dialog (such as adding or removing a control), the function must indicate this by returning true. This will cause the dialog content to be rebuilt.

Type declaration

Optional Readonly rootElement

rootElement: HTMLElement

If a tree of DOM nodes is required to represent this control, this will point to the root element of that tree. This property is set by the interface framework and should be considered read only.

Optional spokenLabel

spokenLabel: string

If defined, screen readers will use this as the label for the control.

type

type: "custom"

The type property must be set to "custom".

This API is still under development and is subject to change. Copyright © Math I Can Do Solutions Incorporated and/or its licensors.