widgets-controller

Classes

Collection

Methods

(static) disable(group)

Source:

Disables widgets, if they aren't disabled already when the branch was disabled by the controller. In most widgets, this function will do nothing because all fieldsets, inputs, textareas and selects will get the disabled attribute automatically when the branch element provided as parameter becomes non-relevant.

Parameters:
Name Type Description
group Element

The element inside which all widgets need to be disabled.

(static) enable(group)

Source:

Enables widgets if they weren't enabled already if they are not readonly. In most widgets, this function will do nothing because the disabled attribute was automatically removed from all fieldsets, inputs, textareas and selects inside the branch element provided as parameter. Note that this function can be called before the widgets have been initialized and will in that case do nothing. This is actually preferable than waiting for create() to complete, because enable() will never do anything that isn't done during create().

Parameters:
Name Type Description
group Element

HTML element

(static) init($group, optsopt) → {boolean}

Source:

Initializes widgets

Parameters:
Name Type Attributes Description
$group jQuery

The element inside which the widgets have to be initialized.

opts * <optional>

Options (e.g. helper function of Form.js passed)

Returns:

true when initialized successfuly

Type
boolean

(inner) _getElements(group, selector) → {jQuery}

Source:

Returns the elements on which to apply the widget

Parameters:
Name Type Description
group Element

A jQuery-wrapped element

selector string | null

If the selector is null, the form element will be returned

Returns:

A jQuery collection

Type
jQuery

(inner) _instantiate(Widget, group)

Source:

Instantiate a widget on a group (whole form or newly cloned repeat)

Parameters:
Name Type Description
Widget object

The widget to instantiate

group Element

The element inside which widgets need to be created.

(inner) _setLangChangeListener(Widget, els)

Source:

Calls widget('update') when the language changes. This function is called upon initialization, and whenever a new repeat is created. In the latter case, since the widget('update') is called upon the elements of the repeat, there should be no duplicate eventhandlers.

Parameters:
Name Type Description
Widget Object

The widget configuration object

els Array.<Element>

Array of elements that the widget has been instantiated on.

(inner) _setOptionChangeListener(Widget, els)

Source:

Calls widget('update') on select-type widgets when the options change. This function is called upon initialization, and whenever a new repeat is created. In the latter case, since the widget('update') is called upon the elements of the repeat, there should be no duplicate eventhandlers.

Parameters:
Name Type Description
Widget Object

The widget configuration object

els Array.<Element>

The array of elements that the widget has been instantiated on.

(inner) _setValChangeListener(Widget, els)

Source:

Calls widget('update') if the form input/select/textarea value changes due to an action outside of the widget (e.g. a calculation).

Parameters:
Name Type Description
Widget Object

The widget configuration object.

els Array.<Element>

The array of elements that the widget has been instantiated on.