Skip to Content
avatar image
Former Member

How to change color of row in SAP UI Table depending on value of particular field.

The color change will happen on button event and selected row should get the new color.

The problem with my code is that the color is getting reflected even when it is scrolled down. As the color is applied on Domref. How to reflect it on particular row.

Code:

onDeleteItem: function() {
			var that = this;
			var oTable = this.getView().byId("IDOrderOverviewTable");
			var oNewTable = oTable.getSelectedIndices();


			if (oNewTable.length !== 0) {
				for (var i = 0; i < oNewTable.length; i++) {
					var oSelectedEntry = oTable.getContextByIndex(oNewTable[i]);
					var oDelSAP = oSelectedEntry.getProperty("DelSAP");
					if (oDelSAP === "X") {
					MessageToast.show("Data is Deleted");
					}
					else {
	oNewTable.forEach(function(Line) {
	$(oTable.getRows()[Line].getDomRefs().rowScrollPart).removeClass('redRemove');
	$(oTable.getRows()[Line].getDomRefs().rowScrollPart).addClass('yellow');
						 });
					}
					oTable.clearSelection();
					MessageToast.show("Data is available in SAP");
				}


}
			 else {
				MessageToast.show("Please select atleast one row");
			}




		},

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Mar 06 at 02:36 PM

    Hi,

    Why don't you use the setHighlight method?

    Add comment
    10|10000 characters needed characters exceeded