Today I will explain the life cycle of the redui control.
CreateAt this stage control gets all the properties and methods.
Most of the properties will be still empty, but the most important ones: id and the type should be set.
Initialize from modelAt this point control model is validated and normalized.
Optional model properties that were not provided are set to their default values. For example, TextBox label, if not provided, is set to "".
Also at this point has a chance to pre-calculate some values. For example, ComboBox options will be retrieved at this moment, packed into objects, stocked into the array and saved on the options property.
At last, it is a moment (and responsibility) of a control to create and initialize its inner controls.
Render to HTMLAll the rendering logic is inside the template. If a control has inner controls, they should be rendered through the template.
ActivateThis is a time to subscribe to DOM events.
One of the most important events is change, which allows databound control to update the object it is bound to.
As with the other stages, the control is responsible to activate every inner control!
Set ValueThis will only happen for databound controls.
All control has to do is to apply the passed value to the DOM element. For example, TextBox needs to set the value of its INPUT element.