Currently I have an sapui table, where I want to have one single row being a link, all other rows should be textviews. my problem is, that constructing the table is based on col
One solution is that you define the template as a HorizontalLayout
. Add additional visibility flags to your existing data model, for example as following VisibleFlagForText
and VisibleFlagForLink
(VisibleFlagForText == !VisibleFlagForLink) .
var oText = new sap.ui.commons.TextView({
text:"{Text01}",
visible : "{VisibleFlagForText}"
});
var oLink = new sap.ui.commons.Link({
text : "{Text01}",
press : pressListOpen,
visible : "{VisibleFlagForLink}"
});
var oLayout = new sap.ui.layout.HorizontalLayout("Layout1",{content: [oText, oLink ]});
oTable.addColumn(new sap.ui.table.Column({
label : new sap.ui.commons.Label({
text : "Berichtsmonat",
hAlign : sap.ui.core.HorizontalAlign.Center,
}),
template : oLayout,
width : '120px',
hAlign : sap.ui.core.HorizontalAlign.Center,
}));
Then you can update the visibility flags of the data model of your single row to set link visible or textview visible.