Class: Model

ko/ui/element~ Model


Model()

This is the model all other UI elements inherit from

Properties:
Name Type Description
name string

Name of the node that will be inserted

isSdkElement boolean

Identify this as a UI sdk element to other modules

$element module:ko/dom~QueryObject

The ko/dom instance for this element

element Element

The main DOM element for this UI element

options object

The options passed to this UI element

attributes object

The attributes passed to this UI element

defaultInit function

The default init function, used by extending modules that want to call the default init logic

Methods


<static> addClass()

Shortcut for this.$element.addClass, see module:ko/dom~QueryObject.addClass


<static> addElement(appendElement [, preferredType])

Adds the given element to the current UI element

This function is designed to take a variety of element "types" to be appended

Parameters:
Name Type Argument Description
appendElement string | object | array | mixed

The element to be appended, it can be a node name, a DOM element, a ko/dom element, an object containing a "type" (nodename) property, in which case it is passed to require("ko/ui/<type>").create(<appendElement>), or an array containing any of the types mentioned.

preferredType null | string <optional>

If this is set and the element type cannot be detected the preferredType is used to initialize a ko/ui/* element eg, require("ko/ui/<preferredType>").create(<appendElement>)


<static> attr()

Shortcut for this.$element.attr, see module:ko/dom~QueryObject.attr


<static> disable()

disable the element (adds disabled=true attribute)


<static> disabled()

Check whether attribute is disabled

Returns:
Type
boolean

<static> empty()

Shortcut for this.$element.empty, see module:ko/dom~QueryObject.empty


<static> enable()

enable the element (removes disabled attribute)


<static> focus()

Shortcut for this.$element.focus, see module:ko/dom~QueryObject.focus


<static> hide()

Hides the element, this calls module:ko/dom~QueryObject.hide


<static> hide()

Shortcut for this.$element.hide, see module:ko/dom~QueryObject.hide


<static> init( [options])

The default init option

Parameters:
Name Type Argument Description
options object <optional>

An object containing the attributes to set for the element, can contain an "options" property to set options for the current UI module (module dependent)


<static> initWithAttribute(attribute, value [, options])

Init function that takes an attribute, value as the first options

Other UI modules can make this their init function, altering the .create() arguments

Parameters:
Name Type Argument Description
attribute string

The attribute to set, if this is an object then it will be used as the options param

value string

The value to set

options object <optional>

An object containing attributes and options


<static> initWithElement(appendElement [, options])

Init function that takes an element or array of elements as the first argument The given elements will be appended to the created element.

Other UI modules can make this their init function, altering the .create() arguments

Parameters:
Name Type Argument Description
appendElement Element | array | object

Element(s) to be appended. This can be a DOM element, ko/dom element or even just the name of an element. See addElement() for more information. If this is a simple object then it will be used as the options param

options object <optional>

An object containing attributes and options


<static> initWithLabel(label [, options])

Init function that takes a label argument

Other UI modules can make this their init function, altering the .create() arguments

Parameters:
Name Type Argument Description
label string | object

The label value, if this is an object then it will be used as the options param

options object <optional>

An object containing attributes and options


<static> off()

Shortcut for this.$element.off, see module:ko/dom~QueryObject.off


<static> on()

Shortcut for this.$element.on, see module:ko/dom~QueryObject.on


<static> once()

Shortcut for this.$element.once, see module:ko/dom~QueryObject.once


<static> parseOptions( [options])

Parses the options object given, this splits the options from the attributes

Parameters:
Name Type Argument Description
options object <optional>

<static> remove()

Shortcut for this.$element.remove, see module:ko/dom~QueryObject.remove


<static> removeAttr()

Shortcut for this.$element.removeAttr, see module:ko/dom~QueryObject.removeAttr


<static> removeClass()

Shortcut for this.$element.removeClass, see module:ko/dom~QueryObject.removeClass


<static> show()

Shortcut for this.$element.show, see module:ko/dom~QueryObject.show


<static> show()

Shows the element, this calls module:ko/dom~QueryObject.show


<static> trigger()

Shortcut for this.$element.trigger, see module:ko/dom~QueryObject.trigger