As was mentioned here Dynamic binding of table column and rows, we use two models, but what if we have one?
var aColumnData = [
{
qual : "1",
ol:100
},
{
qual : "2",
ol:200
},
{
qual : "3",
ol:300
},
{
qual : "2",
ol:400
},
{
qual : "5",
ol:500
}
];
I want to achieve table with 5 columns (ol), but with this method,
var myTable = new sap.ui.table.Table("mT");
myTable.setModel(vizModel);
myTable.bindColumns("/", function(index, context) {
var sColumnId = context.getProperty().ol;
var xColumnId = context.getProperty().qual;
return new sap.ui.table.Column({
label: sColumnId ,
template: new sap.ui.commons.TextField ({value: xColumnId})
});
});
myTable.bindRows("/");
I have 5 duplicate rows, like this:
100 200 300 400 500
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
instead of having this:
100 200 300 400 500
1 2 3 4 5