Widget - AppDaddy-Software-Solutions-Inc/framework-markup-language GitHub Wiki
Widget is an inherited class and cannot be created directly in markup.
This is the base class for all widgets. Every widget has the ability to utilize bindings and attributes from the base widget, though the base widget is not a widget used in your templates. The base widget uses the ID as its main attribute, which allows for the widget to be bound to, acted on by events, and referenced directly. Widgets without an ID will be bindable through references such as {this}, {parent}, and {child}
The attributes of a widget are bindables that return a value based on the {id.property}. Properties can be referenced using {this.property} if binding within a widgets own property or {parent.property} which refers to the immediate parent. Properties such as 'parent' will return the id of the widgets parent, giving access to that widgets bindings without directly referencing its id.
Name | Type | Default | Description | Req |
---|---|---|---|---|
id | string | The id of the widget used for binding data. If not specified, a unique id is automatically generated. Auto-generated id's typically start with "auto". | ||
debug | bool | false | Turns debugging on/off for the specified widget, Note: Not all widgets support debug. |
|
scope | string | false | Some widgets like List Item, Table Row, Pager Page and Grid Item are, by default, created within their own scope. For other widgets that are normally created under their parents scope, setting scope forces the widget create itself under a new unique scope. Use scope="id" where id of the name of the new scope to create. |
Name | Description |
---|---|
set(value) | Sets the widget's value attribute to the specified value |
attribute.set(value) | Sets the specified attribute of the widget to the specified value (ex. color.set('red')) |
addChild(markup, index) | Parses the passed FML markup, renders the FML widget(s) and adds them to the child widget list starting at the index specified. If index is omitted, the children are added to the end of the child list. |
removeChild(index) | Removes the widget from the child widget list at the specified index. Index 0 is the first child. If index is omitted, the last child is removed. |
removeChildren() | Clears the all children |
replaceChild(markup, index) | Parses the passed FML markup, renders the FML widget(s) and replaces the widget in the child widget list at the index specified with the newly created widget(s). If index is omitted, it assumes the last widget in the child list. |
replaceChildren(markup) | Parses the passed FML markup, renders the FML widget(s) and replaces all children in the widget child list with the newly created children. |
removeWidget(index) | Removes the sibling of this widget at the specified index. If index is omitted, it assumes the last widget in the sibling list. |
replaceWidget(markup) | Parses the passed FML markup, renders the FML widget(s) and adds it to the widgets child list |