Skip to Content
0
Jan 24, 2018 at 08:32 PM

Pass data from detail view to Master view SAPUI5

1061 Views

I need to pass data from detail view to master view after selecting a checkbox as shown below.

on the detail controller I already have the checkbox function:

    estSelect: function(oEvent) {

var isSelected = oEvent.getParameter("selected");
var cxt = oEvent.getSource().getBindingContext();
var wordName = cxt.getObject("Word");

if (isSelected) {
cxt.getModel().setProperty("percent", "100%", cxt);
               this.updateSummary(wordName);
} else {
cxt.getModel().setProperty("percent", null, cxt);
}
}, 

I was trying to create a tree table with the data to the master view content:

    updateSummary: function(mName) {
var summaryLocation = sap.ui.getCore().byId("<masterContentLocation>");

var oModel = new sap.ui.model.json.JSONModel([{
title: mName,
children: [{
title: mName
}]
}]);

sap.ui.require([], function() {
var oTree = new sap.m.Tree({});
oTree.setModel(oModel);
var oStandardTreeItem = new sap.m.StandardTreeItem({
title: "{title}"
});
oTree.bindItems("/", oStandardTreeItem);
oTree.placeAt(summaryLocation);
});

Attachments

wanted.png (32.6 kB)