Instead of using CSS we can use sap.m.ObjectStatus
to apply colors.
var iDtemplate = new sap.m.ColumnListItem("idTemplate", {
type: "Navigation",
visible: true,
selected: true,
cells: [
new sap.m.ObjectStatus({
text: "{SlNo}",
}).bindProperty("state", "number", function(value) {
return getStatusColor(value);
}),
new sap.m.ObjectStatus({
text: "{Name}",
}).bindProperty("state", "number", function(value) {
return getStatusColor(value);
}),
],
pressListMethod: function(event) {
var bindingContext = event.getSource().getBindingContext();
}
});
function getStatusColor(status) {
if (status === '') {
return "Error";
} else {
return "Success";
}
}
Based on the number field we are giving colors to columns Slno and Name.