Namespace chip.bag
The namespace for the CHIP API's bag contract, which allows you to
access property bags attached to a CHIP instance and read or write properties in these bags.
Defined in: bag.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
chip.bag.getBag(sBagId)
Returns the associated property bag for a given ID.
|
| <static> |
chip.bag.getBagIds()
Returns an array of IDs of all associated property bags which currently exist.
|
| <static> |
chip.bag.getOriginalLanguage()
Returns this CHIP instance's original language as BCP-47.
|
Method Detail
<static>
{sap.ui2.srvc.Bag}
chip.bag.getBag(sBagId)
Returns the associated property bag for a given ID. If no bag with the given ID exists, a
new, empty bag is created on the fly.
- Parameters:
- {string} sBagId
- The ID of the bag to be returned
- Since:
- 1.5.0
- Returns:
- {sap.ui2.srvc.Bag} The associated bag
<static>
{string[]}
chip.bag.getBagIds()
Returns an array of IDs of all associated property bags which currently exist.
Note that new bags are created on the fly if you call
getBag with any other ID.
- Since:
- 1.5.0
- Returns:
- {string[]} IDs of associated bags
<static>
{string}
chip.bag.getOriginalLanguage()
Returns this CHIP instance's original language as BCP-47.
If you are logged on in the same language or if the original language is empty, translatable
texts can be created and modified for this CHIP instance and its bags.
See sap.ui2.srvc.Bag#setText.
Note: Handling of translatable texts depends on the layer used. In some layers the original
language is important; in others it does not matter. In the latter case the empty string
("") is returned, which indicates that the user is allowed to edit the
translatable texts in any language.
The following code is a flexible way of checking the current situation without knowing the current language or layer:
if (oChipInstance.getOriginalLanguage() === "" || oChipInstance.getOriginalLanguage() ===
sap.ui.getCore().getConfiguration().getLanguage()) {
// create and modify the CHIP instance's texts
}
- Since:
- 1.17.1
- Returns:
- {string} this CHIP instance's original language (BCP-47) or
""