Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2161

sap.m.table binding with odata not working

$
0
0

Hi all,

 

I have an odata webservice made from ecc . I have bound the odata webservice to a dropdown control in ui5 view "Filter.View.js" where its working fine. Now in another view "POItm.View.js" from the same webservice and entityset , I am trying to bind a sap.m.table inside controller of Main.View (on a click of an item inside a main view) but the binding is not working. I am not able to figure out how the same odata model object for the same entity is getting bound successfully to a drop down in one view but not to table in another view. (There is no error in console)

 

Below is the code for Filter view , where odata binding to dropdown is working.

sap.ui.controller("cmp.zerp_app.Filter", {
/**
* Called when a controller is instantiated and its View controls (if available) are already created.
* Can be used to modify the View before it is displayed, to bind event handlers and do other one-time initialization.
* @memberOf zerp_app.Filter
*/  onInit: function() {      //OData model with webservice URL from ECC   var oData_Hdr = new sap.ui.model.odata.ODataModel("proxy/http/59.99.233.46:8002/sap/opu/odata/sap/zprj_po_srv/");   sap.ui.getCore().setModel(oData_Hdr,"Model_Hdr");   //this.getView().setModel(oData_Hdr,"Model_Hdr");      sap.ui.getCore().byId("Combo_Vend").bindItems({path:"Model_Hdr>/Vendor_ListSet",                                                template: new sap.ui.core.ListItem({text:"{Model_Hdr>Name1}",                                                                                key:"{Model_Hdr>Lifnr}"})                                                   });            sap.ui.getCore().byId("Combo_Comp").bindItems({path:"Model_Hdr>/Comp_ListSet",                                                     template: new sap.ui.core.ListItem({text:"{Model_Hdr>Butxt}",                                                                                      key:"{Model_Hdr>Bukrs}"})                                                   });  },

 

Below is the code for controller of Main.View where odata binding to table is not working. (Using debugger , i checked that it is triggering the below click_order method when i click on the list time)

 

sap.ui.controller("cmp.zerp_app.Main", {
 click_order: function(oEvent){  //Binding PO Item Table with Odata Model    var TBL_poitm = sap.ui.getCore().byId("Tbl_Itm");  TBL_poitm.bindAggregation("items",{                                path: "Model_Hdr>/Comp_ListSet",                                           template:new sap.m.ColumnListItem({                                                  cells:[                                                       new sap.m.Label({text:"{Model_Hdr>Bukrs}",                                                                        vAlign:sap.ui.core.VerticalAlign.Middle}),                                                       new sap.m.Label({text:"{Model_Hdr>Bukrs}"}),                                                       new sap.m.Label({text:"{Model_Hdr>Bukrs}"}),                                                       new sap.m.Label({text:"{Model_Hdr>Bukrs}"}),                                                       new sap.m.Label({text:"{Model_Hdr>Bukrs}"}),                                                       new sap.m.Label({text:"{Model_Hdr>Bukrs}"}),                                                       new sap.m.Label({text:"{Model_Hdr>Bukrs}"}),                                                 ] //end of cell                                              }) // end of template                                    });                  }       });

 

Below is how my sap.m.table is defined in PoItem.View

 

sap.ui.jsview("cmp.zerp_app.POItem", {   getControllerName : function() {   return "cmp.zerp_app.POItem";  },    var oTBL_Itm = new sap.m.Table("Tbl_Itm",{                                                       headerText: "Item Details",                                                       noDataText : "No Items for selected Purchase Order",                                              columns:[new sap.m.Column({header:new sap.m.Label({text:"Itm No",                                                                                            design: sap.m.LabelDesign.Bold})}),                                                       new sap.m.Column({header:new sap.m.Label({text:"Material",                                                                                            design: sap.m.LabelDesign.Bold}),                                                                  //  hAlign:"Center"                                                                  }),                                                       new sap.m.Column({header:new sap.m.Label({text:"PO Qty",                                                                                            design: sap.m.LabelDesign.Bold}),                                                                  //  hAlign:"Center",                                                                    minScreenWidth:"Tablet",                                                                    demandPopin : true

//                                                                     footer: new sap.m.Text({text:"Grand Total:",

//                                                                                         enabled:false})                                                                       }),                                                       new sap.m.Column({header:new sap.m.Label({text:"Price",                                                                                             design: sap.m.LabelDesign.Bold}),                                                                   // hAlign:"Center",                                                                    minScreenWidth:"Small",                                                                    demandPopin : true

//                                                                     footer: new sap.m.Text("Txt_Tot",{enabled:false})                                                                       }),                                                       new sap.m.Column({header:new sap.m.Label({text:"Amt",                                                                                            design: sap.m.LabelDesign.Bold}),                                                                  //  hAlign:"Center",                                                                    minScreenWidth:"Tablet",                                                                    demandPopin : true}),                                                         new sap.m.Column({header:new sap.m.Label({text:"Delv Status",                                                                                            design: sap.m.LabelDesign.Bold}),                                                                  //   hAlign:"Center"                                                                    minScreenWidth:"Tablet",                                                                    demandPopin : true                                                                  }),                                                       new sap.m.Column({header:new sap.m.Label({text:"Inv Status",                                                                                            design: sap.m.LabelDesign.Bold}),

//                                                                       hAlign:"Center"                                                                    minScreenWidth:"Tablet",                                                                    demandPopin : true                                                                  }),                                                      ]                                           });

Viewing all articles
Browse latest Browse all 2161

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>