SAPUI5 provides more controls like Input, Button, List etc., for application developer to design the application. But in some scenarios, these controls may not be full fill the requirements. In this time, we need to create our control (custom control) as per our requirements.
Custom control is composition of existing controls (Composite Control) for the implementation.
As same in existing controls and it is called as Standard Composite Control.
But now, there is feasibility to create the custom control using XML which is called as XML Composite Control.
- XML Fragment
XML Fragmentation is used for XML implementation and should appear in the same folder as the control’s JS implementation with the same name, file extension control.xml .
The fragment’s content can access the interface data from the XML Composite control via bindings.
Note: Currently only aggregations and properties are supported for binding inside a fragment.
Internal bindings in the fragment can be possible by exposed model provided by framework which has the default name $this. The name will always start with an $.
Name of the exposed model can be defined with alias.
Internally the XMLComposite instantiates and initializes the given fragment and stores the resulting control in a hidden aggregation named _content. The fragment should only include one root element.
Note: There is no specific renderer method; the rendering is handled generically by the framework.
To access the Panel and table mentioned in the above fragment snippet using oControl.get_content() method.
Here _appendix is hidden aggregation of control
And like to show the employee list in the screen using this aggregation. Setting the list control using setAggregation method.
Finally, Panel, Table and List are displayed in the screen.
In this scenario, Handling of renderer method by developer.
Integration of this control in XML view
In Js View
Hope this blog is helpful to you..