You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
not sure if it's a bug or a feature...
Loading of components in fragments by configured usage, works only if enclosed by component.runAsOwner.
See exaple provided below.
App.contoller.js function handlePressWorks Works as expected. App.contoller.js function handlePressBroken Well, is broken...
In general, I see the same behavior with older versions
The question is forwarded to the dev team for clarification on the required settings for loading other component into the current component, via #1880578895
The working example seems to be the only way to get this working right now.
Without calling this.getOwnerComponent().runAsOwner within the controller, the owner component is not propagated and therefore, the ComponentContainer fails to create the "usage" component defined.
It seems that the ComponentContainer is not prepared for being instantiated with a "usage" property but without having an owner component defined, that's why the error message is confusing and not really helpful.
So we have two things that should be improved:
Better error message in ComponentContainer for this scenario
Check for a better solution to create fragments (or controls in general) from a controller method by ensuring to propagate the owner component. This should also be documented somewhere in the Developer Guide.
Anyway, in the meantime the proposals of @matz3 have been implemented for quite some time already.
So if you are still interested there is an asynchronous loadFragment() function on the sap.ui.core.mvc.Controller class that takes care of the Owner component setting internally.
Adding the Fragment content to the dependents aggregation of the view is also implicitly done, but you can opt out if needed: https://ui5.sap.com/#/api/sap.ui.core.mvc.Controller%23methods/loadFragment
Hi,
not sure if it's a bug or a feature...
Loading of components in fragments by configured usage, works only if enclosed by component.runAsOwner.
See exaple provided below.
App.contoller.js function handlePressWorks
Works as expected.App.contoller.js function handlePressBroken
Well, is broken...OpenUI5 version: 1.52.19
Browser/version (+device/version): All
Any other tested browsers/devices(OK/FAIL):
URL (minimal example if possible):
https://plnkr.co/edit/32jCltN2VErODLszAGOQ?p=preview
Steps to reproduce the problem:
What is the expected result?
Dialog schould oupen like pressed "Works!" Button
What happens instead?
"Component-dbg.js:2022 Uncaught Error: The name of the component is undefined."
Any other information? (attach screenshot if possible)
Kind Regards
Markus
The text was updated successfully, but these errors were encountered: