Hello
I am trying to show a dialog pop on a record selection from table. I am able to get the selected record as well. But when i bind the list item inside a dialog to the binding context - the dialog pop is not shown. If I put path directly inside listitem it shows all the records - but i only want to show selected record details.
Please see and let me know what part is wrong here.
var oListItem = oEvent.getParameter("listItem") || oEvent.getSource();
var sItemName = oListItem.getBindingContext().getProperty("FirstName");
var sbindingcontext= oListItem.getBindingContext() ;
// I am using Northwind service and mapped to /Employees. sbindingcontext value is ="/Employees(1)//
var l1id =sap.ui.getCore().byId('l1');
l1id.bindProperty("path",sbindingcontext);
jQuery.sap.require("sap.m.Dialog");
jQuery.sap.require("sap.m.List");
jQuery.sap.require("sap.m.Button");
jQuery.sap.require("sap.m.StandardListItem");
var dialog = new sap.m.Dialog({
title: 'Selected Employee Details',
contentWidth: "550px",
contentHeight: "300px",
draggable: true,
resizable: true,
content: new sap.m.List({
id:"l1",
items: {
template: new sap.m.StandardListItem({
title: "{FirstName}"+" {LastName}",
})
}
}),
beginButton: new sap.m.Button({
text: 'Close',
press: function () {
dialog.close();
}
}),
afterClose: function() {
dialog.destroy();
}
});
//to get access to the global model
this.getView().addDependent(dialog);
dialog.open();