I retrieve from server a json with two field: an array of the structure (columns list) and an array with the effective data. I see this example https://openui5.hana.ondemand.com/explored.html#/sample/sap.m.sample.Table/code and here i can mapping (data-binding) dinamically the data in the table but I have to manually enter the columns!!!!
How can I mappin automatically also the structure (cols) of my table?
Now I use a code in the controller that insert a list of cols and the rows:
for(var i=0; i<tableResult.getModel().getProperty("/cols").length; i++){
tableResult.addColumn(new sap.m.Column(tableResult.getModel().getProperty("/cols")[i], { header: new sap.m.Label({design:"Bold" , text: tableResult.getModel().getProperty("/cols")[i] })}));
}
tableResult.bindAggregation("items", "/items", new sap.m.ColumnListItem({
cells: tableResult.getModel().getProperty("/cols").map(function (colname) {
return new sap.m.Label({ text: "{" + colname + "}" });
}),
type:myType
}));
But I do not like this solution