Skip to Content

Styles of cells in sap.ui.table.Table can be changed by


changing style class names (whose are preliminary defined in css file)

in corresponding properties of table model (see oModelObject.styleClassName[j] below)

and then applying them to corresponding table cells (see aCells[j].addStyleClass below) in following way:


oTable = sap.ui.getCore().byId(sTableId);
if (oTable) {
     aRows = oTable.getRows();
     if (aRows && aRows.length > 0){
          for (i = 0; i < aRows.length; i++) {
               oModelObject = aRows[i].getBindingContext().getObject();
               aCells = aRows[i].getCells();
               if (oModelObject && aCells && aCells.length > 0) {
                    for (j = 0; j < aCells.length; j++) {
                         aCells[j].addStyleClass(oModelObject.styleClassName[j]);
                    }
               }
          }
     }
}
To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply