top of page

Pivot2 - Spread color from one column to entire row

Updated: Mar 16, 2023

Currently, in pivot, we can set colors to a column based on its value. In that case color will get applied to only that column. Below script will spread color from a column to entire row




widget.on('ready', function(se, ev) {
	
	panelName = 'Value 1' //Update your panel name from which color needs to spread to entire row
	
	 if (prism.activeWidget == null)
	   widgetelement = $('[widgetid="'+ se.oid + '"] pivot2 .pivot-scroller table tbody tr')
	 else
	   widgetelement = $('.pivot-scroller table tbody tr', element)
	   
	var colIndex = -1
	$(widgetelement).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)
				})

				$(widgetelement).each(function(rowIndex, rowElement){
					if(rowIndex > 0 && index == rowIndex){
						$(rowElement).find('td').css('backgroundColor', bgColor)
					}
				})
			}
		}

	})
})




コメント

5つ星のうち0と評価されています。
まだ評価がありません

評価を追加
BI Next Level white logo

BI Next Level is your trusted resource for BI customization, data solutions, and expert insights. Explore practical tips, scripts, and tutorials for tools like Sisense, Python, and SQL. Let’s transform your data into impactful insights together.

Quick Links
Connect with us
Copyright © 2024. All Rights Reserved. Designed, Developed & Maintained  by Intertoons
bottom of page