class sap.ui.core.mvc.XMLView

Control sample: sap.ui.core.mvc.XMLView
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/core/mvc/XMLView
Application Component: CA-UI5-COR

A View defined using XML and, optionally, pure HTML markup.

Note:
Be aware that modifications of the content aggregation of this control are not supported due to technical reasons. This includes calls to all content modifying methods like addContent> etc., but also the implicit removal of controls contained by the content aggregation. For example the destruction of a Control via the destroy method. All functions can be called but may not work properly or lead to unexpected side effects.

Note:
On root level, you can only define content for the default aggregation, e.g. without adding the <content> tag. If you want to specify content for another aggregation of a view like dependents, place it in a child control's dependents aggregation or add it by using sap.ui.core.mvc.XMLView#addDependent.


Constructor

Constructor for a new XMLView.

Note: Application code shouldn't call the constructor directly, but rather use the factory XMLView.create or View.create with type XML. The factory provides more features than the constructor (e.g. caching and preprocessing) and simplifies asynchronous loading of a view. Future features might only be available when using the factory.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.

This class does not have its own settings, but all settings applicable to the base type sap.ui.core.mvc.View can be used.

new sap.ui.core.mvc.XMLView(sId?, mSettings?)
Param Type Default Value Description
sId? string

ID for the new view, generated automatically if no ID is given

mSettings? object

Initial settings for the new view

Borrowed Properties

Name Type Default Value Description
displayBlock boolean false

Whether the CSS display should be set to "block". Set this to "true" if the default display "inline-block" causes a vertical scrollbar with Views that are set to 100% height. Do not set this to "true" if you want to display other content in the same HTML parent on either side of the View (setting to "true" may push that other content to the next/previous line).

Visibility: public
height sap.ui.core.CSSSize

The height

Visibility: public
viewName string

Name of the View

Visibility: public
width sap.ui.core.CSSSize 100%

The width

Visibility: public
blocked boolean false

Whether the control is currently in blocked state.

Visibility: public
busy boolean false

Whether the control is currently in busy state.

Visibility: public
busyIndicatorDelay int 1000

The delay in milliseconds, after which the busy indicator will show up for this control.

Visibility: public
busyIndicatorSize sap.ui.core.BusyIndicatorSize Medium

The size of the BusyIndicator. For controls with a width smaller 3rem a sap.ui.core.BusyIndicatorSize.Small should be used. If the size could vary in width and the width could get smaller than 3rem, the sap.ui.core.BusyIndicatorSize.Auto option could be used. The default is set to sap.ui.core.BusyIndicatorSize.Medium For a full screen BusyIndicator use sap.ui.core.BusyIndicatorSize.Large.

Since: 1.54.

Visibility: public
fieldGroupIds string[]

The IDs of a logical field group that this control belongs to.

All fields in a logical field group should share the same fieldGroupId. Once a logical field group is left, the validateFieldGroup event is fired.

For backward compatibility with older releases, field group IDs are syntactically not limited, but it is suggested to use only valid sap.ui.core.IDs.

See #attachValidateFieldGroup or consult the Field Group documentation.

Since: 1.31.

Visibility: public
visible boolean true

Whether the control should be visible on the screen.

If set to false, a placeholder will be rendered to mark the location of the invisible control in the DOM of the current page. The placeholder will be hidden and have zero dimensions (display: none).

Also see InvisibleRenderer.

Visibility: public

Borrowed Aggregations

Name Cardinality Type Description
content 0..n sap.ui.core.Control

Child Controls of the view

customData 0..n sap.ui.core.CustomData

Custom Data, a data structure like a map containing arbitrary key value pairs.

dependents 0..n sap.ui.core.Element

Dependents are not rendered, but their databinding context and lifecycle are bound to the aggregating Element.

Since: 1.19.

dragDropConfig 0..n sap.ui.core.dnd.DragDropBase

Defines the drag-and-drop configuration. Note: This configuration might be ignored due to control metadata restrictions.

Since: 1.56.

layoutData 0..1 sap.ui.core.LayoutData

Defines the layout constraints for this control when it is used inside a Layout. LayoutData classes are typed classes and must match the embedding Layout. See VariantLayoutData for aggregating multiple alternative LayoutData instances to a single Element.

tooltip 0..1 sap.ui.core.TooltipBase

The tooltip that should be shown for this Element.

In the most simple case, a tooltip is a string that will be rendered by the control and displayed by the browser when the mouse pointer hovers over the control's DOM. In this variant, tooltip behaves like a simple control property.

Controls need to explicitly support this kind of tooltip as they have to render it, but most controls do. Exceptions will be documented for the corresponding controls (e.g. sap.ui.core.HTML does not support tooltips).

Alternatively, tooltip can act like a 0..1 aggregation and can be set to a tooltip control (an instance of a subclass of sap.ui.core.TooltipBase). In that case, the framework will take care of rendering the tooltip control in a popup-like manner. Such a tooltip control can display arbitrary content, not only a string.

UI5 currently does not provide a recommended implementation of TooltipBase as the use of content-rich tooltips is discouraged by the Fiori Design Guidelines. Existing subclasses of TooltipBase therefore have been deprecated. However, apps can still subclass from TooltipBase and create their own implementation when needed (potentially taking the deprecated implementations as a starting point).

See the section Using Tooltips in the Fiori Design Guideline.


Methods Overview

Method Description
sap.ui.core.mvc.XMLView.create

Instantiates an XMLView from the given configuration options.

If a viewName is given, it must be a dot-separated name of an XML view resource (without the mandatory suffix ".view.xml"). The resource will be loaded asynchronously via the module system (preload caches might apply) and will be parsed as XML. Alternatively, an already loaded view definition can be provided, either as XML string or as an already parsed XML document. Exactly one of viewName or definition must be given, if none or both are given, an error will be reported.

The controller property is optional and can hold a controller instance. When given, it overrides the controller class defined in the view definition.

Note: On root level, you can only define content for the default aggregation, e.g. without adding the <content> tag. If you want to specify content for another aggregation of a view like dependents, place it in a child control's dependents aggregation or add it by using sap.ui.core.mvc.XMLView#addDependent.

Note: If you enable caching, you need to take care of the invalidation via keys. Automatic invalidation takes only place if the UI5 version or the component descriptor (manifest.json) change. This is still an experimental feature and may experience slight changes of the invalidation parameters or the cache key format.

sap.ui.core.mvc.XMLView.extend

Creates a new subclass of class sap.ui.core.mvc.XMLView with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.mvc.View.extend.

sap.ui.core.mvc.XMLView.getMetadata

Returns a metadata object for class sap.ui.core.mvc.XMLView.

sap.ui.core.mvc.XMLView.registerPreprocessor

Register a preprocessor for all views of a specific type.

The preprocessor can be registered for several stages of view initialization, for xml views these are either the plain "xml" or the already initialized "controls" , see sap.ui.core.mvc.XMLView.PreprocessorType. For each type one preprocessor is executed. If there is a preprocessor passed to or activated at the view instance already, that one is used. When several preprocessors are registered for one hook, it has to be made sure, that they do not conflict when being processed serially.

It can be either a module name as string of an implementation of sap.ui.core.mvc.View.Preprocessor or a function with a signature according to sap.ui.core.mvc.View.Preprocessor.process.

Note: Preprocessors work only in async views and will be ignored when the view is instantiated in sync mode by default, as this could have unexpected side effects. You may override this behaviour by setting the bSyncSupport flag to true.

sap.ui.core.mvc.XMLView.create

Instantiates an XMLView from the given configuration options.

If a viewName is given, it must be a dot-separated name of an XML view resource (without the mandatory suffix ".view.xml"). The resource will be loaded asynchronously via the module system (preload caches might apply) and will be parsed as XML. Alternatively, an already loaded view definition can be provided, either as XML string or as an already parsed XML document. Exactly one of viewName or definition must be given, if none or both are given, an error will be reported.

The controller property is optional and can hold a controller instance. When given, it overrides the controller class defined in the view definition.

Note: On root level, you can only define content for the default aggregation, e.g. without adding the <content> tag. If you want to specify content for another aggregation of a view like dependents, place it in a child control's dependents aggregation or add it by using sap.ui.core.mvc.XMLView#addDependent.

Note: If you enable caching, you need to take care of the invalidation via keys. Automatic invalidation takes only place if the UI5 version or the component descriptor (manifest.json) change. This is still an experimental feature and may experience slight changes of the invalidation parameters or the cache key format.

Param Type DefaultValue Description
oOptions object

An object containing the view configuration options.

id string

Specifies an ID for the View instance. If no ID is given, an ID will be generated.

viewName string

Corresponds to an XML module that can be loaded via the module system (oOptions.viewName + suffix ".view.xml")

definition string Document

XML string or XML document that defines the view. Exactly one of viewName or definition must be given.

controller sap.ui.core.mvc.Controller

Controller instance to be used for this view. The given controller instance overrides the controller defined in the view definition. Sharing one controller instance between multiple views is not possible.

cache object

Cache configuration; caching gets active when this object is provided with vView.cache.keys array; keys are used to store data in the cache and for invalidation of the cache.

keys Array<(string Promise<string>)>

Array with strings or Promises resolving with strings

preprocessors object

Preprocessors configuration, see sap.ui.core.mvc.View Note: These preprocessors are only available to this instance. For global or on-demand availability use sap.ui.core.mvc.XMLView.registerPreprocessor.

sap.ui.core.mvc.XMLView.extend

Creates a new subclass of class sap.ui.core.mvc.XMLView with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.mvc.View.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

sap.ui.core.mvc.XMLView.getMetadata

Returns a metadata object for class sap.ui.core.mvc.XMLView.

sap.ui.core.mvc.XMLView.registerPreprocessor

Register a preprocessor for all views of a specific type.

The preprocessor can be registered for several stages of view initialization, for xml views these are either the plain "xml" or the already initialized "controls" , see sap.ui.core.mvc.XMLView.PreprocessorType. For each type one preprocessor is executed. If there is a preprocessor passed to or activated at the view instance already, that one is used. When several preprocessors are registered for one hook, it has to be made sure, that they do not conflict when being processed serially.

It can be either a module name as string of an implementation of sap.ui.core.mvc.View.Preprocessor or a function with a signature according to sap.ui.core.mvc.View.Preprocessor.process.

Note: Preprocessors work only in async views and will be ignored when the view is instantiated in sync mode by default, as this could have unexpected side effects. You may override this behaviour by setting the bSyncSupport flag to true.

Param Type DefaultValue Description
sType string sap.ui.core.mvc.XMLView.PreprocessorType

the type of content to be processed

vPreprocessor string function

module path of the preprocessor implementation or a preprocessor function

sViewType string "XML"

Since 1.89, added for signature compatibility with View#registerPreprocessor. Only supported value is "XML".

bSyncSupport boolean

declares if the vPreprocessor ensures safe sync processing. This means the preprocessor will be executed also for sync views. Please be aware that any kind of async processing (like Promises, XHR, etc) may break the view initialization and lead to unexpected results.

bOnDemand boolean

ondemand preprocessor which enables developers to quickly activate the preprocessor for a view, by setting preprocessors : { xml }, for example.

mSettings object

optional configuration for preprocessor