Utility class for state handling of MDC controls. The StateUtil
class is offering a generic way to retrieve states and set a desired state for a given MDC control. The StateUtil
class is tightly coupled to the SAPUI5 flexibility integration of MDC controls. To use the APIs of Stateutil
, the given MDC control instance needs to fully enable all available p13nMode
options. This way, Stateutil
can create the required changes and retrieve the relevant state of each control.
Method | Description |
---|---|
sap.ui.mdc.p13n.StateUtil.applyExternalState |
Creates and applies the necessary changes for a given control and state. Note:The changes are created in the same order as the objects are passed into the state object attributes. For example, by adding two objects into the
|
sap.ui.mdc.p13n.StateUtil.retrieveExternalState |
Retrieves the externalized state for a given control instance. The retrieved state is equivalent to the |
Creates and applies the necessary changes for a given control and state. Note:The changes are created in the same order as the objects are passed into the state object attributes. For example, by adding two objects into the items
attribute of the oState
object, the first entry is created, and the second entry is created on top of the first change. The item state is applied for each provided object in the given order in the array and uses the provided position. If no index or only an invalid index has been provided, the item is added to the array after the last item in the affected control's item aggregation. In addition the following attributes can be used to remove a state:
sorted
- Set to false
in the sorters
scope to remove a sorter/code>.grouped
- Set to false
in the groupLevels
scope to remove a grouping.visible
- Set to false
to remove an aggregation item.aggregated
- Set to false
to remove an aggregation.Param | Type | DefaultValue | Description |
---|---|---|---|
oControl | object |
The control that is used to create changes and to which changes are made |
|
oState | object |
The state in which the control is represented |
Retrieves the externalized state for a given control instance. The retrieved state is equivalent to the getCurrentState
API for the given control, after all necessary changes have been applied (for example, variant appliance and p13n, StateUtil
changes). After the returned Promise
has been resolved, the returned state is in sync with the according state object of the MDC control (for example, filterConditions
for the FilterBar
control).
Param | Type | DefaultValue | Description |
---|---|---|---|
oControl | object |
The control instance implementing IxState to retrieve the externalized state |