ManagedObject: "objectBindings" support in XML view / fragment definitions
See original GitHub issueURL (minimal example if possible)
https://jsbin.com/hopizef/edit?html,js,output
Given
<MyControl objectBindings="{
myModel: { path: '/someObject' },
myAnotherModel: { path: '/objectFromAnotherModel' }
}" />
What is the expected result?
ManagedObject calls bindObject
according to the API contract for each key without any issues.
https://github.com/SAP/openui5/blob/ca82db0229de26dec2fc554353838ad8e6fc5401/src/sap.ui.core/src/sap/ui/base/ManagedObject.js#L1150-L1153
What happens instead?
The only place in the XMlTemplateProcessor, where objectBindings
is handled, is this one:
https://github.com/SAP/openui5/blob/ca82db0229de26dec2fc554353838ad8e6fc5401/src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js#L803-L809
But that results in the following objectBindings
object:
{ undefined: { myAnotherModel: { path: "/objectFromAnotherModel" }, myModel: { path: "/someObject" } } }
which is passed to ManagedObject settings: https://github.com/SAP/openui5/blob/ca82db0229de26dec2fc554353838ad8e6fc5401/src/sap.ui.core/src/sap/ui/base/ManagedObject.js#L1142-L1155
And since the key is undefined
, the browser throws an uncaught TypeError.
Any other information? (attach screenshot if possible)
After reading https://github.com/SAP/openui5/issues/544, I thought objectBindings
is supported at least in fragments but there it fails too.
Also the description of objectBindings
in the API reference …
objectBindings
: object A map of binding paths keyed by the corresponding model name. Each entry with keyk
in this object has the same effect as a callthis.bindObject(objectBindings[k], k);
.
… is a bit weird to me since bindObject
awaits an object as the only argument.
But according to the description above, this.bindObject(path, modelName)
will be called. In the real code, on the other hand, it’s this.bindObject(bindingInfo)
again.src
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Hello @boghyon ,
Thank you for sharing your enhancement proposal. I’ve created an internal incident 2080221780. The status of the issue will be updated here in GitHub.
Regards, Florian
Hi @boghyon, we’ve discussed your enhancement proposal and agreed on implementing it. The BLI is CPOUI5FRAMEWORK-122. This issue will be updated when the BLI is implemented. Best Regards, Florian