HI,
I am developing a master detail page for a Purchase Order application. In master page, i display the list of Purchase Orders & on clicking the PO, i should display the detail page.
We use different ODATA models for Master & detail page. I am able to successfully list the POs in master page & i am struggling on the part where i have to pass the selected PO number to the new ODATA service URL & then display the details in a table.
Below is the code i use on TAP of Purchase order from master page:
tap: function(oEvent)
{
sap.ui.getCore().byId("PODetailstable_nodata_id").setVisible(false);
var oContext=oEvent.getSource().getBindingContext();
var odataModel_PO_detail = new sap.ui.model.odata.ODataModel(detailServiceUrl,false, "dev_sde", "28aug@2013");
odataModel_PO_detail.setCountSupported(false);
var tappedPONumber= oContext.getProperty("PONumber");
var path = "/POHeaderSet('"+tappedPONumber+"')/HDRtoITM";
PO_DetailsPage.setBindingContext(oContext);
sap.ui.getCore().byId("po_details_table_id").setModel(odataModel_PO_detail);
sap.ui.getCore().byId("po_details_table_id").bindContext(path);
sap.ui.getCore().byId("po_details_table_id").setVisible(true);
},
And below is the code of my Detail page & the table: I set the bindcontext with new path at "tap" function in master page, i also do bindaggregation for the table with the new path.
The issue is i am able to HIT the new service URL, but no data is displayed. There is also a demo application on the same, but w/o source code it doesnt help me much in resolving this issue.
var PODetailstable_nodata = new sap.m.Table("PODetailstable_nodata_id",{title : "No Data"});
var po_details_table = new sap.m.Table("po_details_table_id", {
inset: true,
headerText: "table for Detail page",
columns: [
new sap.m.Column({
header: new sap.m.Label({ text: "PO Number" }) }),
new sap.m.Column({ header: new sap.m.Label({ text: "Vendor" }) }),
new sap.m.Column({
header: new sap.m.Label({ text: "Vendor Name" }) }),
],
});
var oTemplate = new sap.m.ColumnListItem({
cells: [
new sap.m.Text({ text: "{PoNumber}" }),
new sap.m.Text({ text: "{Vendor}" }),
new sap.m.Text({ text: "{VendorName}"})
]
});
po_details_table.bindAggregation("items", {
path:"/POHeaderSet('"+"{PONumber}"+"')/HDRtoITM",
template: oTemplate
});
var PO_DetailsPage = new sap.m.Page("PO_DetailsPage_id",
{
// title : "Purchase Order Details",
title : "{PoNumber}",
content : [
PODetailstable_nodata,
po_details_table,
],
footer : new sap.m.Bar
({
contentRight: [
new sap.m.Button({
text : "Approve",
//press: oController.approve_pr,
}
)
],
}
),
});