on 04-21-2017 7:07 AM
Hi Experts,
I have a grid table in which one column is a combobox . I want to populate the combobox
with the entries using oData . I want to know how to do that. I am posting my code for the grid table below.
var tblContractLineDescription = new sap.ui.table.Table("tbl_ContractLineDescription",{
selectionMode :sap.ui.table.SelectionMode.MultiToggle,
selectionBehavior:sap.ui.table.SelectionBehavior.RowSelector,
title : "Contract Line Description"
});
tblContractLineDescription.addColumn(new sap.ui.table.Column({
label : new sap.m.Label({text : "Contract Line Description"}),
template : new sap.m.Text({text : "{OrderID}"}),
}));
tblContractLineDescription.addColumn(new sap.ui.table.Column({
label : new sap.m.Label({text : "Unit Of Measure"}),
template : new sap.m.Text({text : "{}"
,editable:true})
}));
tblContractLineDescription.addColumn(new sap.ui.table.Column({
label:new sap.m.Label({
text:"Commodity Code"}),
template:new sap.m.Text({
text:"{}"
})
}));
tblContractLineDescription.addColumn(new sap.ui.table.Column({
label:new sap.m.Label({
text:"Count"
}),
template:new sap.m.Input({
text:"{}"
})
}));
tblContractLineDescription.addColumn(new sap.ui.table.Column({
label:new sap.m.Label({
text:"Sub Commodity Code"
}),
template: new sap.m.ComboBox("cbx_forTable",{
text:"{EmployeeID}"
})
}));
tblContractLineDescription.addColumn(new sap.ui.table.Column({
label:new sap.m.Label({
text:"Comment"
}),
template:new sap.m.Input({
text:"{}"
})
}));
Hi Aman ,
You can do like this :
var cTemplate = new sap.ui.core.ListItem();
cTemplate.bindProperty("key","<key variable in the comboBox data>");
cTemplate.bindProperty("text","<text variable in the comboBox data>");
template : new sap.m.ComboBox().bindItems("<path of the comboBox data>",cTemplate).bindProperty("selectedKey","<key of initial selected Item>");
thanks
viplove
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi viplove,
I have to insert this as a column inside a grid table. I tried your solution but its not giving the result .
Thanks
Aman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, i think might be i mentioned the wrong item of the combo template ..
replace var cTemplate = new sap.ui.core.ListItem(); with var cTemplate = new sap.ui.core.Item();
If that doesn't work too than can you just share you code . i can take a look and get back to you after seeing it
thanks
Viplove
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.