Skip to Content
author's profile photo Former Member
Former Member

Binding table item problem with expand list

Hi Experts,

I have an entity set HeaderSet with sale orders and item entity set ItemSet. I have defined the navigation sets, so that automatic expand happens using framework. It worked everything fine from gateway perspective. I'm displaying sale orders as an table and by choosing the order, i want to display items. I checked in debugging that when i select the sale order, expand is working fine and properly returning the corresponding sale order items. Here, problem is i could not able to see the data in the item table. It is problem with the binding. Please check the code here.

GatewayService: /sap/opu/odata/sap/ZORDER_SRV/HeaderSet('1')?$expand=ItemSet01 working fine.

Skeleton Code under controller:

//Template to map the data to the respective column

var template2 = new sap.m.ColumnListItem({

id: "second_template",

type: "Navigation",

visible: true,

cells: [

new sap.m.Label("ID2", {

text: "{M2>Vbeln}"

}),

new sap.m.Label({

text: "{M2>Posnr}"

}),

new sap.m.Label({

text: "{M2>Product}"

}),

new sap.m.Label({

text: "{M2>Total}"

})

]

});

var oFilters = null;

//For Odata model

oTable2.bindItems( "M2>/",template2, null, oFilters);

Code Under View:

var arrParams = ["$expand=ItemSet01"];

var sServiceUrl2 = "http://PUNSEZSAPVM31.ad.infosys.com:8010/sap/opu/odata/sap/ZORDER_SRV";

var oModel2 = new sap.ui.model.odata.ODataModel(sServiceUrl2,true);

// here sItemName coming when we select the order which is working properly

oModel2.read("/HeaderSet('" + sItemName + "')?", null,arrParams,

false,function(oData2, oResponse){

list2 = oData2.results; });

console.log(list2);

var oJsonModel2 = new sap.ui.model.json.JSONModel();

oJsonModel2.setData(list2);

sap.ui.getCore().setModel(oJsonModel2,"M2");

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 13, 2016 at 06:50 AM

    Hi k p,

    why you are adding oFilter in the bindItems if there is no filter ...

    try this :

    oTable2.bindItems( "M2>/",template2);


    thanks

    Viplove

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.