sap.ui.model.Model.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.model.Model 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.message.MessageProcessor.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.model.Model.
Returns:
Attach event-handler fnFunction
to the 'parseError' event of this sap.ui.model.Model
.
Parameters:
{object} | oData? | The object, that should be passed along with the event-object when firing the event. |
{function} | fnFunction | The function to call, when the event occurs. This function will be called on the oListener-instance (if present) or in a 'static way'. |
{object} | oListener? | Object on which to call the given function. If empty, the global context (window) is used. |
Returns:
Attach event-handler fnFunction
to the 'requestCompleted' event of this sap.ui.model.Model
.
Parameters:
{object} | oData? | The object, that should be passed along with the event-object when firing the event. |
{function} | fnFunction | The function to call, when the event occurs. This function will be called on the oListener-instance (if present) or in a 'static way'. |
{object} | oListener? | Object on which to call the given function. If empty, the global context (window) is used. |
Returns:
Attach event-handler fnFunction
to the 'requestFailed' event of this sap.ui.model.Model
.
Parameters:
{object} | oData? | The object, that should be passed along with the event-object when firing the event. |
{function} | fnFunction | The function to call, when the event occurs. This function will be called on the oListener-instance (if present) or in a 'static way'. |
{object} | oListener? | Object on which to call the given function. If empty, this Model is used. |
Returns:
Attach event-handler fnFunction
to the 'requestSent' event of this sap.ui.model.Model
.
Parameters:
{object} | oData? | The object, that should be passed along with the event-object when firing the event. |
{function} | fnFunction | The function to call, when the event occurs. This function will be called on the oListener-instance (if present) or in a 'static way'. |
{object} | oListener? | Object on which to call the given function. If empty, the global context (window) is used. |
Returns:
Create ContextBinding
Parameters:
{string|object} | sPath | the path pointing to the property that should be bound or an object which contains the following parameter properties: path, context, parameters |
{object} | oContext? | the context object for this databinding (optional) |
{object} | mParameters? | additional model specific parameters (optional) |
{object} | oEvents? | event handlers can be passed to the binding ({change:myHandler}) |
Returns:
Implement in inheriting classes
Parameters:
{string} | sPath | the path pointing to the list / array that should be bound |
{object} | oContext? | the context object for this databinding (optional) |
{sap.ui.model.Sorter} | aSorters? | initial sort order (can be either a sorter or an array of sorters) (optional) |
{array} | aFilters? | predefined filter/s (can be either a filter or an array of filters) (optional) |
{object} | mParameters? | additional model specific parameters (optional) |
Returns:
Implement in inheriting classes
Parameters:
{string} | sPath | the path pointing to the property that should be bound |
{object} | oContext? | the context object for this databinding (optional) |
{object} | mParameters? | additional model specific parameters (optional) |
Returns:
Implement in inheriting classes
Parameters:
{string} | sPath | the path pointing to the tree / array that should be bound |
{object} | oContext? | the context object for this databinding (optional) |
{array} | aFilters? | predefined filter/s contained in an array (optional) |
{object} | mParameters? | additional model specific parameters (optional) |
{array} | aSorters? | predefined sap.ui.model.sorter/s contained in an array (optional) |
Returns:
Implement in inheriting classes
Parameters:
{string} | sPath | the path to create the new context from |
{object} | oContext? | the context which should be used to create the new binding context |
{object} | mParameters? | the parameters used to create the new binding context |
{function} | fnCallBack? | the function which should be called after the binding context has been created |
{boolean} | bReload? | force reload even if data is already available. For server side models this should refetch the data from the server |
Returns:
destroy()
Destroys the model and clears the model data. A model implementation may override this function and perform model specific cleanup tasks e.g. abort requests, prevent new requests, etc.
See:
sap.ui.base.Object.prototype.destroy |
destroyBindingContext(oContext)
Implement in inheriting classes
Parameters:
{object} | oContext | to destroy |
Detach event-handler
fnFunction
from the 'parseError' event of this
sap.ui.model.Model
.
The passed function and listener object must match the ones previously used for event registration.
Parameters:
{function} | fnFunction | The function to call, when the event occurs. |
{object} | oListener | Object on which the given function had to be called. |
Returns:
Detach event-handler
fnFunction
from the 'requestCompleted' event of this
sap.ui.model.Model
.
The passed function and listener object must match the ones previously used for event registration.
Parameters:
{function} | fnFunction | The function to call, when the event occurs. |
{object} | oListener | Object on which the given function had to be called. |
Returns:
Detach event-handler
fnFunction
from the 'requestFailed' event of this
sap.ui.model.Model
.
The passed function and listener object must match the ones previously used for event registration.
Parameters:
{function} | fnFunction | The function to call, when the event occurs. |
{object} | oListener | Object on which the given function had to be called. |
Returns:
Detach event-handler
fnFunction
from the 'requestSent' event of this
sap.ui.model.Model
.
The passed function and listener object must match the ones previously used for event registration.
Parameters:
{function} | fnFunction | The function to call, when the event occurs. |
{object} | oListener | Object on which the given function had to be called. |
Returns:
Fire event parseError to attached listeners.
Parameters:
{object} | mArguments? | the arguments to pass along with the event. |
{int} | mArguments.errorCode? | |
{string} | mArguments.url? | |
{string} | mArguments.reason? | |
{string} | mArguments.srcText? | |
{int} | mArguments.line? | |
{int} | mArguments.linepos? | |
{int} | mArguments.filepos? | |
Returns:
Fire event requestCompleted to attached listeners.
Parameters:
{object} | mArguments? | the arguments to pass along with the event. |
{string} | mArguments.url? | The url which was sent to the backend. |
{string} | mArguments.type? | The type of the request (if available) |
{boolean} | mArguments.async? | If the request was synchronous or asynchronous (if available) |
{string} | mArguments.info? | additional information for the request (if available) deprecated |
{object} | mArguments.infoObject? | Additional information for the request (if available) |
Returns:
Fire event requestFailed to attached listeners.
Parameters:
{object} | mArguments? | the arguments to pass along with the event. |
{string} | mArguments.message? | A text that describes the failure. |
{string} | mArguments.statusCode? | HTTP status code returned by the request (if available) |
{string} | mArguments.statusText? | The status as a text, details not specified, intended only for diagnosis output |
{string} | mArguments.responseText? | Response that has been received for the request ,as a text string |
Returns:
Fire event requestSent to attached listeners.
Parameters:
{object} | mArguments? | the arguments to pass along with the event. |
{string} | mArguments.url? | The url which is sent to the backend. |
{string} | mArguments.type? | The type of the request (if available) |
{boolean} | mArguments.async? | If the request is synchronous or asynchronous (if available) |
{string} | mArguments.info? | additional information for the request (if available) deprecated |
{object} | mArguments.infoObject? | Additional information for the request (if available) |
Returns:
Get the default binding mode for the model
Returns:
getMessagesByPath(sPath)
Get messages for path
Parameters:
{string} | sPath | The binding path |
Returns the meta model associated with this model if it is available for the concrete model type.
Returns:
getObject(sPath, oContext?)
Implement in inheriting classes
Parameters:
{string} | sPath | the path to where to read the object |
{object} | oContext? | the context with which the path should be resolved |
getOriginalProperty(sPath, oContext?): any
Returns the original value for the property with the given path and context. The original value is the value that was last responded by a server if using a server model implementation.
Parameters:
{string} | sPath | the path/name of the property |
{object} | oContext? | the context if available to access the property value |
Returns:
{any} | vValue the value of the property |
getProperty(sPath, oContext?)
Implement in inheriting classes
Parameters:
{string} | sPath | the path to where to read the attribute value |
{object} | oContext? | the context with which the path should be resolved |
isBindingModeSupported(sMode)
Check if the specified binding mode is supported by the model.
Parameters:
isLegacySyntax(): boolean
Returns whether legacy path syntax is used
Returns:
refresh(bForceUpdate)
Refresh the model. This will check all bindings for updated data and update the controls if data has been changed.
Parameters:
{boolean} | bForceUpdate | Update controls even if data has not been changed |
Set the default binding mode for the model. If the default binding mode should be changed, this method should be called directly after model instance creation and before any binding creation. Otherwise it is not guaranteed that the existing bindings will be updated with the new binding mode.
Parameters:
Returns:
setLegacySyntax(bLegacySyntax)
Enables legacy path syntax handling
This defines, whether relative bindings, which do not have a defined binding context, should be compatible to earlier releases which means they are resolved relative to the root element or handled strict and stay unresolved until a binding context is set
Parameters:
{boolean} | bLegacySyntax | the path syntax to use |
setMessages(mMessages)
Sets messages
Parameters:
{object} | mMessages | Messages for this model |
setSizeLimit(iSizeLimit)
Set the maximum number of entries which are used for list bindings.
Parameters:
{int} | iSizeLimit | collection size limit |