0 votes
1 view
in SAP by (7k points)
How can I retrieve the View/Fragment a sap.ui.core.Control belongs to?

BR Chris

1 Answer

0 votes
by (14.5k points)

If the identifier of the control contains the View's identifier, users could extract and call the same. They may use the following line of code:

sap.ui.getCore().byId("__xmlview42")

This will help them get the containing view. 

However, if the identifier is not present, users can navigate through the control tree using the following line of code:

control.getParent()

You could also navigate through the control tree until you reach the view. But this won't work for Fragments as the content will become part of the parent View.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...