on 07-20-2016 7:22 AM
Hi all,
Now I want to bind the model to the first level aggregations —table and the second level aggregation — multiComboBox. But it seems not to work. Whether the binding method is wrong or any other way to binding? Thanks for any suggestion.
sap.ui.define([
"sap/m/HBox",
"sap/m/CheckBox",
"sap/m/MultiComboBox",
"sap/ui/model/json/JSONModel"
], function(HBox, CheckBox, MultiComboBox, JSONModel) {
"use strict";
var aData = {
pms:
[{label:'1',chekced:true,isOthers:true,others:
[{label:'11'},{label:'12'}]},
{label:'2',chekced:true,isOthers:true,others:
[{label:'21'},{label:'22'}]},
{label:'3',chekced:true,isOthers:true,others:
[{label:'31'},{label:'32'}]},
{label:'4',chekced:true,isOthers:true,others:
[{label:'41'},{label:'42'}]},
{label:'5',chekced:true,isOthers:true,others:
[{label:'51'},{label:'52'}]}]
};
var oModel = new JSONModel();
oModel.setData(aData);
var oComboBox = new MultiComboBox({
width: "200px",
enabled: true,
items:{
path:'/others',
templateShareable: false,
template: new sap.ui.core.Item({
text:"{label}"
})
}
});
var oCheckBox = new CheckBox({
selected: "{/checked}",
text:'{label}'
});
var template = new sap.m.ColumnListItem({
cells:[
oComboBox,
oCheckBox
]
});
var table = new sap.m.Table({
columns:[new sap.m.Column({header: new sap.m.Text({text:'col1'})}),
new sap.m.Column({header: new sap.m.Text({text:'col1'})})]
}).bindAggregation('items','/pms',template);
table.setModel(oModel);
var oHBox = new HBox({
items: [table]
});
oHBox.placeAt("content");
});
Thanks,
Mengchi
Hi Mengchi,
MultiComboBox 'items' binding path should be 'others'.
var oComboBox = new MultiComboBox({
width: "200px",
enabled: true,
items:{
path:'others',
templateShareable: false,
template: new sap.ui.core.Item({
text:"{label}"
})
}
});
Code updated and now it works fine: JS Bin - Collaborative JavaScript Debugging
Regards,
Sai.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.