Reputation: 27
I'm using sap.m.Tree with JSON model. On the tree item select, I would like to see the path in the model.
I have made an example with a tree and callback for itemPress
event:
var oTree = new sap.m.Tree("tree", {
itemPress: function(oEvent) {
console.log("itemPress event =", oEvent);
var items = oEvent.getParameter("listItem");
console.log("parameters", items);
}
});
I guess I should get path from the model from oEvent
parameter but can't see anything helpful as I inspect it.
Upvotes: 1
Views: 1970
Reputation: 18044
You can get the binding path from the bound context of the pressed item:
oEvent.getParameter("listItem").getBindingContext(/*modelName*/).getPath()
Upvotes: 2