Skip to Content
0
Jun 24, 2015 at 09:25 AM

Two dropdown buttons in a table, trying to bind each with defferent services but getting undefined error. Please help

142 Views

Hello experts,

Please help me on this.

I have two dropdown controls and rest textfield controls in my table. I want to bind each dropdown control with different OData service. When i am trying to bind dropdown controls with model, it throwing following error:

Cannot read property 'setModel' of undefined, Its not able to identify dropdown control. Why so. I tried following things, but could not figure out the way out.

Please have a look at this and help:

Dashboard.js

var stockTable = new sap.ui.table.Table({

id: this.createId("StockTabId"),

});

stockTable.addColumn(new sap.ui.table.Column({

label: new sap.ui.commons.Label({text: "Shade Name",wrapping : true}),

template: new sap.ui.commons.DropdownBox({

id : "sboxID",

searchHelpEnabled : true,

items: {

path: "/",

template: new sap.ui.core.ListItem({text: "{SHADENAME}", wrapping: true})

},

change: function(oEvent) {

var ShadeVal = this.getValue();

var index = oEvent.getSource().getBindingContext().sPath.substring(1,2);

oController.fetchSCode(ShadeVal,index);

}

})

Dashboard.controller

this.getView().byId("sboxID-col2-row0-input").setModel(oShadeModel);

Also tried, sap.ui.getCore().byId("sboxID-col2-row0-input").setModel(oShadeModel);

The actual id of dropdown box is sboxID-col2-row0-input (got after inspecting element), i am not able to figure out why its not able to find the control.

Please help,

Thank you,

Best Regards,

Chetna