0
votes

How can I set fragment ID and access the control itself and all other controls in the fragment from the controller via ID?

<IconTabFilter id="fragOrder" key="Order Detail" text="Order Detail" >
  <content>
    <core:Fragment id="idOrderFrag" fragmentName="OrderDetail"  type="XML" />
  </content> 
</IconTabFilter>        

Console:

console.log(" >>" + this.getView().getId("fragOrder"));
console.log(" >>" + this.getView().getId("idOrderFrag"));
1

1 Answers

-1
votes

You can not get the instance of the Fragment as the fragment itself is not rendered, the controls inside the fragment are rendered. You can only get the rendered control instances inside the fragment xml.

For example, you have a input control has an id called "order_name",you can get the input by the following code:

this.byId(sap.ui.core.Fragment.createId("idOrderFrag", "order_name"));

See the documentation here about fragment ids.