Class sap.ui.core.FragmentModule: sap/ui/core/Fragment
Fragments support the definition of light-weight stand-alone UI control trees. This class acts as factory which returns the UI control tree defined inside the Fragments. When used within declarative Views, the Fragment content is imported and seamlessly integrated into the View.
Fragments are used similar as sap.ui.core.mvc.Views, but Fragments do not have a Controller on their own (they may know one, though), they are not a Control, they are not part of the UI tree and they have no representation in HTML. By default, in contrast to declarative Views, they do not do anything to guarantee ID uniqueness.
But like Views they can be defined in several Formats (XML, declarative HTML, JavaScript; support for other types can be plugged in), the declaration syntax is the same as in declarative Views and the name and location of the Fragment files is similar to Views. Controller methods can also be referenced in the declarations, but as Fragments do not have their own controllers, this requires the Fragments to be used within a View which does have a controller. That controller is used, then.
Do not call the Fragment constructor directly!
Use-cases for Fragments are e.g.: - Modularization of UIs without fragmenting the controller structure - Re-use of UI parts - 100%-declarative definition of Views
mSettings
that defines initial property values, aggregated and associated objects as well as event handlers.sClassName
and enriches it with the information contained in oClassInfo
. Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.
The supported settings are:
- Properties
- type : string
In addition, all settings applicable to the base type sap.ui.base.ManagedObject can be used as well.
{string} | sFragmentId | |
{string} | sId |
{string} | sFragmentId | |
{string} | sId |
sClassName
and enriches it with the information contained in oClassInfo
. oClassInfo
might contain the same kind of information as described in sap.ui.base.ManagedObject.extend.
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? | Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata |
{function} | Created class / constructor function |
{sap.ui.base.Metadata} | Metadata object describing this class |
{string} | sType | the Fragment type. Types "XML", "HTML" and JS" are built-in and always available. |
{object} | oFragmentImpl | an object having a property "init" of type "function" which is called on Fragment instantiation with the settings map as argument |
type
. When called with a value of null
or undefined
, the default value of the property will be restored.
{string} | sType | New value for property type |
{sap.ui.core.Fragment} | Reference to this in order to allow method chaining |