I have a tree that looks as following:
and the XML view:
<Tree id="classTree" items="{path: 'Tree>/'}" toggleOpenState="onToggleOpenState">
<CustomTreeItem>
<FlexBox width="100%" alignItems="Center" justifyContent="SpaceBetween">
<items>
<Label text="{Tree>text}" wrapping="true"/>
<Button icon="sap-icon://display" type="Transparent" press="onItemPress"/>
</items>
</FlexBox>
</CustomTreeItem>
</Tree>
As you can see, there is a button with the event press="onItemPress"
that is implemented as following:
onItemPress: function (oEvent) {
const oRow = oEvent.getSource().getParent().getParent();
console.log(oRow.getItemNodeContext());
},
The return value is an object https://sapui5.hana.ondemand.com/#/api/sap.m.TreeItemBase/methods/getExpanded,that has the following value:
How to get the object, that is bind to the row?
What about:
oEvent.getSource().getBindingContext("Tree").getObject();