sap.ui.core.mvc.View.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.core.mvc.View 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.Control.extend.
Parameters:
{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 |
Returns:
{function} | Created class / constructor function |
Returns a metadata object for class sap.ui.core.mvc.View.
Returns:
sap.ui.core.mvc.View.registerPreprocessor(sType, vPreprocessor, sViewType, bSyncSupport, bOnDemand?, mSettings?)
Register a preprocessor for all views of a specific type.
The preprocessor can be registered for several stages of view initialization, which are dependant from the view type, e.g. "raw", "xml" or already initialized "controls". 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 beeing 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 only work 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
.
Parameters:
{string} | sType | the type of content to be processed |
{string|function} | vPreprocessor | module path of the preprocessor implementation or a preprocessor function |
{string} | sViewType | type of the calling view, e.g. XML |
{boolean} | bSyncSupport | 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. |
{boolean} | bOnDemand? | on-demand preprocessor which enables developers to quickly activate the preprocessor for a view, by setting preprocessors : { xml } , for example. This should be false except for very special cases. There can only be one on-demand preprocessor per content type. |
{object} | mSettings? | optional configuration for preprocessor |
Adds some content to the aggregation content
.
Parameters:
Returns:
Attaches event handler
fnFunction
to the
afterInit
event of this
sap.ui.core.mvc.View
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.core.mvc.View
itself.
Fired when the View has parsed the UI description and instantiated the contained controls (/control tree).
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.ui.core.mvc.View itself |
Returns:
Attaches event handler
fnFunction
to the
afterRendering
event of this
sap.ui.core.mvc.View
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.core.mvc.View
itself.
Fired when the View has been (re-)rendered and its HTML is present in the DOM.
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.ui.core.mvc.View itself |
Returns:
Attaches event handler
fnFunction
to the
beforeExit
event of this
sap.ui.core.mvc.View
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.core.mvc.View
itself.
Fired when the view has received the request to destroy itself, but before it has destroyed anything.
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.ui.core.mvc.View itself |
Returns:
Attaches event handler
fnFunction
to the
beforeRendering
event of this
sap.ui.core.mvc.View
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.core.mvc.View
itself.
Fired before this View is re-rendered. Use to unbind event handlers from HTML elements etc.
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.ui.core.mvc.View itself |
Returns:
Returns an element by its ID in the context of the view.
Parameters:
{string} | sId | View local ID of the element |
Returns:
Override clone method to avoid conflict between generic cloning of content and content creation as defined by the UI5 Model View Controller lifecycle.
For more details see the development guide section about Model View Controller in UI5.
Parameters:
{string} | sIdSuffix? | a suffix to be appended to the cloned element id |
{string[]} | aLocalIds? | an array of local IDs within the cloned hierarchy (internally used) |
Returns:
createId(sId): string
Convert the given view local element ID to a globally unique ID by prefixing it with the view ID.
Parameters:
{string} | sId | View local ID of the element |
Returns:
Destroys all the content in the aggregation content
.
Returns:
Detaches event handler
fnFunction
from the
afterInit
event of this
sap.ui.core.mvc.View
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
Detaches event handler
fnFunction
from the
afterRendering
event of this
sap.ui.core.mvc.View
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
Detaches event handler
fnFunction
from the
beforeExit
event of this
sap.ui.core.mvc.View
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
Detaches event handler
fnFunction
from the
beforeRendering
event of this
sap.ui.core.mvc.View
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
Fires event afterInit
to attached listeners.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
Fires event afterRendering
to attached listeners.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
Fires event beforeExit
to attached listeners.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
Fires event beforeRendering
to attached listeners.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
Gets content of aggregation
content
.
Child Controls of the view
Returns:
getController(): object
Returns the view's Controller instance or null for a controller-less View.
Returns:
{object} | Controller of this view. |
getControllerName(): string
An (optional) method to be implemented by Views. When no controller instance is given at View instantiation time AND this method exists and returns the (package and class) name of a controller, the View tries to load and instantiate the controller and to connect it to itself.
Returns:
{string} | the name of the controller |
getDisplayBlock(): boolean
Gets current value of property
displayBlock
.
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).
Default value is false
.
Returns:
{boolean} | Value of property displayBlock |
Gets current value of property
height
.
The height
Returns:
getViewData(): object
Returns user specific data object
Returns:
getViewName(): string
Gets current value of property
viewName
.
Name of the View
Returns:
{string} | Value of property viewName |
Gets current value of property
width
.
The width
Default value is 100%
.
Returns:
hasPreprocessor(sType): boolean
Checks if any preprocessors are active for the specified type
Parameters:
{string} | sType | Type of the preprocessor, e.g. "raw", "xml" or "controls" |
Returns:
{boolean} | true if a preprocessor is active |
indexOfContent(oContent): int
Checks for the provided sap.ui.core.Control
in the aggregation content
. and returns its index if found or -1 otherwise.
Parameters:
Returns:
{int} | The index of the provided control in the aggregation if found, or -1 otherwise |
Inserts a content into the aggregation content
.
Parameters:
{sap.ui.core.Control} | oContent | the content to insert; if empty, nothing is inserted |
{int} | iIndex | the 0 -based index the content should be inserted at; for a negative value of iIndex , the content is inserted at position 0; for a value greater than the current size of the aggregation, the content is inserted at the last position |
Returns:
loaded(): Promise
Creates a Promise representing the state of the view initialization.
For views that are loading asynchronously (by setting async=true) this Promise is created by view initialization. Synchronously loading views get wrapped in an immediately resolving Promise.
- Since:
- 1.30
Returns:
{Promise} | resolves with the view instance, fulfilled when completely initialized |
Removes all the controls from the aggregation
content
.
Additionally, it unregisters them from the hosting UIArea.
Returns:
Removes a content from the aggregation content
.
Parameters:
Returns:
runPreprocessor(sType, vSource, bSync?): Promise|object|string|element
Executes preprocessors for a type of source
Parameters:
{string} | sType | the type of preprocessor, e.g. "raw", "xml" or "controls" |
{object|string|Element} | vSource | the view source as a JSON object, a raw text, an XML document element or a Promise resolving with those |
{boolean} | bSync? | describes the view execution, true if sync |
Returns:
{Promise|object|string|element} | a promise resolving with the processed source or an error | the source when bSync=true |
Sets a new value for property
displayBlock
.
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).
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
Parameters:
{boolean} | bDisplayBlock | New value for property displayBlock |
Returns:
Sets a new value for property
height
.
The height
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
Returns:
Sets a new value for property
viewName
.
Name of the View
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
{string} | sViewName | New value for property viewName |
Returns:
Sets a new value for property
width
.
The width
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is 100%
.
Parameters:
Returns: