Skip to Content
0

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

Feb 14 at 11:58 AM

24

avatar image
Former Member

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




		},

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Iftah Peretz
Mar 06 at 02:36 PM
0

Hi,

Why don't you use the setHighlight method?

Share
10 |10000 characters needed characters left characters exceeded