on 10-05-2015 2:13 PM
Dear colleagues,
please help me with this UI5 problem.
I created a JSON model and bind it to my Component.
Then I receive this JSON model in my View that is binded to the same Component.
All JSON data except the table data is received correctly.
But table data does not received from JSON to View.
Here are my code:
(Component.js)
...
var main_source_model = new JSONModel();
var module_patch = jQuery.sap.getModulePath("sap.ui.x5.forms", "/json/TableData.json");
main_source_model.loadData(module_patch, "", false);
this.setModel(main_source_model, "main_source");
...
(TableData.json)
{
"output":{
...
"groups":[
{
...
"lines":[ ... ]
...
}
]
}
}
(MultiTable.view.js)
DFC.output.groups.forEach(function(group, i){
if(group.edit == "X") bCellEditable = "{settings>/edit_tables}";
else bCellEditable = false;
aTblColumns = [];
aTblCells = [];
DFC.output.columns_short.forEach(function(column, j){
aTblColumns[j] = new sap.m.Column({
header: new sap.m.Label({text: "{main_source>/output/columns_short/"+j+"/name}"})
});
aTblCells[j] = new sap.m.Input({
type:"Text",
enabled:true,
editable: bCellEditable,
value: "{"+column.id+"}"
});
});
aTblColumns[0].setWidth("10px").setHAlign(sap.ui.core.TextAlign.Center);
ColListItems[i] = new sap.m.ColumnListItem({cells: aTblCells});
aGroupTables[i] = new sap.m.Table({
columns:[aTblColumns],
});
//====================================================================================
aGroupTables[i].bindAggregation("items", { path: 'main_source>/output/groups/'+ i +'/lines', template: ColListItems[i] });
//====================================================================================
aGroupPanels[i] = new sap.m.Panel({
headerText: "{main_source>/output/groups/"+i+"/name}",
expandable: true,
expanded: true,
backgroundDesign: sap.m.BackgroundDesign.Transparent,
content: [
new sap.m.Label({text: "{main_source>/output/groups/"+i+"/name}"}), //There is displayed correctly
aGroupTables[i]
]
});
});
In the end, I see the table. It has a line, but they are empty ... what am I doing wrong?
Hi Sergey,
Try -
aTblCells[j] = new sap.m.Input({
type:"Text",
enabled:true,
editable: bCellEditable,
value: "{main_source>"+column.id+"}"
});
Regards,
Sai Vellanki.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
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.