Class metawidget.widgetprocessor.SimpleBindingProcessor
Simple data/action binding implementation. Frameworks that supply
their own data-binding mechanisms (such as Angular JS) should
override this with their own WidgetProcessor.
Defined in: metawidget-widgetprocessors.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
bindToWidget(widget, value, elementName, attributes, mw)
Bind the given widget to the given value.
|
|
getWidgetFromBinding(binding, mw)
Returns the widget associated with the given binding.
|
|
onStartBuild(mw)
|
|
processWidget(widget, elementName, attributes, mw)
|
|
reload(reloadFrom, mw)
Reloads the values in the widgets using the values in the given Object.
|
|
save(mw)
Save the bindings associated with the given Metawidget.
|
|
saveFromWidget(binding, mw)
|
Method Detail
bindToWidget(widget, value, elementName, attributes, mw)
Bind the given widget to the given value.
- Parameters:
- widget
- value
- elementName
- attributes
- mw
- Returns:
- true if this binding should be remembered for when the user calls 'save'
getWidgetFromBinding(binding, mw)
Returns the widget associated with the given binding. By default, calls
binding.widget. Subclasses may override this method if their
framework has swapped out the widget.
- Parameters:
- binding
- mw
onStartBuild(mw)
- Parameters:
- mw
processWidget(widget, elementName, attributes, mw)
- Parameters:
- widget
- elementName
- attributes
- mw
reload(reloadFrom, mw)
Reloads the values in the widgets using the values in the given Object.
The names of the values in the Object must match the 'name' attribute of
the widget.
Note this method does not update mw.toInspect, nor does it save any values back from the widgets. It can be useful for re-populating the widgets based on an HTTP request POST-back.
- Parameters:
- reloadFrom
- mw
save(mw)
Save the bindings associated with the given Metawidget.
- Parameters:
- mw
- Returns:
- true if data (including data from nested Metawidgets) was actually changed. False otherwise. Can be useful for 'dirty' flags
saveFromWidget(binding, mw)
- Parameters:
- binding
- mw
- Returns:
- the given binding's widget value