TK.ChildElement

new ChildElement(widget, name, config)

Creates a HTMLElement as a child for a widget. Is used to simplify widget definitions. E.g. the tiny marker used to display the back-end value is a simple DIV added using TK.ChildElement. The generic element is a DIV added to TK.Widget.element with the class toolkit-[name]. Default creating and adding can be overwritten with custom callback functions.

Parameters:
Name Type Description
widget TK.Widget

The TK.Widget to add the TK.ChildElement to.

name string

The identifier of the element. It will be prefixed by an underscore TK.Widget["_" + config.name].

config object

The configuration of the child element.

Properties:
Name Type Attributes Default Description
config.show boolean <optional>
false

Show/hide the child element on initialization.

config.option string <optional>
"show_"+config.name

A custom option of the parent widget to determine the visibility of the child element. If this is null, TK.Widget.options["show_"+ config.name] is used to toggle its visibility. The child element is visible, if this options is !== false.

config.display_check function <optional>

A function overriding the generic show_option behavior. If set, this function is called with the value of show_option as argument as soon as it gets set and is supposed to return a boolean defining the visibility of the element.

config.append function <optional>

A function overriding the generic append mechanism. If not null, this function is supposed to take care of adding the child element to the parent widgets DOM.

config.create function <optional>

A function overriding the generic creation mechanism. If not null, this function is supposed to create and return a DOM element to be added to the parent widget.

config.toggle_class boolean <optional>
false

Defines if the parent widget receives the class toolkit-has-[name] as soon as the child element is shown.

config.draw_options array <optional>

A list of options of the parent widget which are supposed to trigger a check if the element has to be added or removed.

config.draw function <optional>

A function to be called on redraw.

Source: