Holds the status data of a binding. To react to changes of this status data, a control must implement the refreshDataState
method, which is called with the name of the bound control property and the data state object as parameters. With the #getChanges method, the control can determine the changed properties and their old and new values.
// sample implementation to handle message changes myControl.prototype.refreshDataState = function (sPropertyName, oDataState) { oDataState.getMessages().forEach(function (oMessage) { console.log(oMessage.getMessage()); } } // sample implementation to handle laundering state myControl.prototype.refreshDataState = function (sPropertyName, oDataState) { this.setBusy(oDataState.isLaundering()); } // sample implementation to handle dirty state myControl.prototype.refreshDataState = function (sPropertyName, oDataState) { if (oDataState.isDirty()) { console.log("Property " + sPropertyName + " of control " + this.getId() + " is dirty"); } }
With the #getProperty method, the control can read a property of the data state. The properties are
controlMessages
The messages created from type validation or parse errors on user input for a property binding dirty
Whether the value was not yet confirmed by the server; use #isDirty to read this property invalidValue
The control value that was rejected by type parsing or validation on user input for a property binding laundering
Whether the value has been sent to the server but is not yet confirmed messages
All messages of the data state modelMessages
The messages available for the binding in its model originalValue
The original value of a property binding in external representation value
The value of a property binding in external representation Method | Description |
---|---|
changed |
Returns whether the data state is changed, or resets the data state in case the parameter |
sap.ui.model.DataState.extend |
Creates a new subclass of class sap.ui.model.DataState with name
|
getChanges |
Returns the changes of the data state in a map that the control can use in the |
getControlMessages |
Returns the array of state messages of the control. |
getInvalidValue |
Returns the dirty value of a binding that was rejected by a type validation so that it could not be applied to the model. If the value was not rejected it returns |
getMessages |
Returns the array of this data state's messages combining the model and control messages. The array is sorted descendingly by message severity. |
sap.ui.model.DataState.getMetadata |
Returns a metadata object for class sap.ui.model.DataState. |
getModelMessages |
Returns the array of state messages of the model or undefined. |
getOriginalValue |
Returns the formatted original value of the data. The original value is the last confirmed value. |
getValue |
Returns the formatted value of the data state. |
isControlDirty |
Returns whether the data state is dirty in the UI control. A data state is dirty in the UI control if the entered value did not yet pass the type validation. |
isDirty |
Returns whether the data state is dirty. A data state is dirty if the value was changed but is not yet confirmed by a server or the entered value did not yet pass the type validation. |
isLaundering |
Returns whether the data state is in laundering. If data is sent to the server, the data state becomes laundering until the data was accepted or rejected. |
setControlMessages |
Sets an array of control state messages. |
setInvalidValue |
Sets the dirty value that was rejected by the type validation. |
setLaundering |
Sets the laundering state of the data state. |
setModelMessages |
Sets an array of model state messages. |
setOriginalValue |
Sets the formatted original value of the data. |
setValue |
Sets the formatted value of the data state, |
Returns whether the data state is changed, or resets the data state in case the parameter bNewState
is false; reset data state means that the data state properties are replaced with the changed properties. As long as there was no call to this method with bNewState
set to false, the data state is dirty, and the corresponding binding will fire data state change events.
Param | Type | DefaultValue | Description |
---|---|---|---|
bNewState | boolean |
Whether the data state is to be reset |
Creates a new subclass of class sap.ui.model.DataState 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.base.Object.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 |
Returns the changes of the data state in a map that the control can use in the refreshDataState
method. The changed property's name is the key in the map. Each element in the map contains an object with the properties oldValue
with the old property value and value
with the new value of the property. The map only contains the changed properties.
Returns the dirty value of a binding that was rejected by a type validation so that it could not be applied to the model. If the value was not rejected it returns undefined
. In this case the current model value can be accessed using the #getValue method.
Returns the array of this data state's messages combining the model and control messages. The array is sorted descendingly by message severity.
Returns the formatted original value of the data. The original value is the last confirmed value.
Returns whether the data state is dirty in the UI control. A data state is dirty in the UI control if the entered value did not yet pass the type validation.
Returns whether the data state is dirty. A data state is dirty if the value was changed but is not yet confirmed by a server or the entered value did not yet pass the type validation.
Returns whether the data state is in laundering. If data is sent to the server, the data state becomes laundering until the data was accepted or rejected.
Sets an array of control state messages.
Param | Type | DefaultValue | Description |
---|---|---|---|
aMessages | sap.ui.core.Message[] |
The control messages |
Sets the dirty value that was rejected by the type validation.
Param | Type | DefaultValue | Description |
---|---|---|---|
vInvalidValue | any |
The value that was rejected by the type validation or |
Sets the laundering state of the data state.
Param | Type | DefaultValue | Description |
---|---|---|---|
bLaundering | boolean |
Whether the state is laundering |
Sets an array of model state messages.
Param | Type | DefaultValue | Description |
---|---|---|---|
aMessages | sap.ui.core.Message[] | [] |
The model messages for this data state. |