cancel
Showing results for 
Search instead for 
Did you mean: 

APPLY CONDITIONAL FORMAT TO ENTIRE ROW

cartercjb
10 - ETL
10 - ETL

Is there a way to apply conditional formatting to an entire row, based on the conditions of 1 value? 

I'm pretty sure I could copy the formula to all other values, but that would be annoying with hows many we have in the pivot. PLUS it would not cover any rows. 

cartercjb_2-1645233131494.png

 

 

5 REPLIES 5

harikm007
13 - Data Warehouse
13 - Data Warehouse

@cartercjb ,

If you are using Pivot2, please try this script (Reference)

widget.on('ready', function(se, ev) {
	
	panelName = 'Value 1' //Update your panel name from which color needs to spread to entire row
	
	var colIndex = -1
	$('pivot2 .pivot-scroller table tbody tr').each(function(index, trElement){ 
		if(index == 0)
		{
			$(trElement).find('td .table-grid__content .table-grid__content__inner').each(function(tdIndex, tdElement){
				if ($(tdElement).text() == panelName){
					colIndex = tdIndex
				}
			})
		}
		else{
			if(colIndex >= 0){
				bgColor = $(trElement).find('.table-grid__cell--col-' + colIndex).css('backgroundColor')
				$(trElement).find('td').each(function(tdIndex, tdElement){
					 $(tdElement).css('backgroundColor', bgColor)
				})

				$('pivot2 .table-grid--rows table tbody tr').each(function(rowIndex, rowElement){
					if(rowIndex > 0 && index == rowIndex){
						$(rowElement).find('td').css('backgroundColor', bgColor)
					}
				})
			}
		}

	})
})

-Hari

 

Thanks, Hari. 

I am using the default Pivot widget.. is that Pivot 2 or is that a blox widget? If it is a blox widget, can you please reference the default article to create a pivot 2 widget? Thanks!

-Carter

cartercjb_0-1645457759271.png

 

harikm007
13 - Data Warehouse
13 - Data Warehouse

@cartercjb , 

Pivot2 is also displayed as normal Pivot widget. My understanding is Pivot2 is available in Sisense Linux version. Not sure if it is available for windows.

-Thanks

Thanks, Hari. @harikm007 

Here is the script I used based on your recommendation:

/*
Welcome to your Widget's Script.

To learn how you can access the Widget and Dashboard objects, see the online documentation at https://developer.sisense.com/pages/viewpage.action?pageId=557127
*/ 

widget.on('ready', function(se, ev) {
	
	panelName = 'UNITS' //Update your panel name from which color needs to spread to entire row
	
	var colIndex = -1
	$('pivot2 .pivot-scroller table tbody tr').each(function(index, trElement){ 
		if(index == 0)
		{
			$(trElement).find('td .table-grid__content .table-grid__content__inner').each(function(tdIndex, tdElement){
				if ($(tdElement).text() == panelName){
					colIndex = tdIndex
				}
			})
		}
		else{
			if(colIndex >= 0){
				bgColor = $(trElement).find('.table-grid__cell--col-' + colIndex).css('backgroundColor')
				$(trElement).find('td').each(function(tdIndex, tdElement){
					 $(tdElement).css('backgroundColor', bgColor)
				})

				$('pivot2 .table-grid--rows table tbody tr').each(function(rowIndex, rowElement){
					if(rowIndex > 0 && index == rowIndex){
						$(rowElement).find('td').css('backgroundColor', bgColor)
					}
				})
			}
		}

	})
})

Here is the output:

cartercjb_0-1645461942537.png 

Am I missing something?

 

 

harikm007
13 - Data Warehouse
13 - Data Warehouse

@cartercjb ,

Please check if you are using pivot2. 

This is how I normally check whether it is Pivot or Pivot2:

 

https://community.sisense.com/t5/embed-analytics/exporting-pivot-table-to-csv/m-p/2088/highlight/tru...

-Hari