Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

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]);
                    }
               }
          }
     }
}