cancel
Showing results for 
Search instead for 
Did you mean: 

Seeking help with a widget script for cell.value

huffnic
7 - Data Storage
7 - Data Storage

Hello,

I am currently using the following widget script for a pivot using rows (no values or columns) on windows OS:

widget.transformPivot({},
    function(metadata, cell) {
        if (cell.value == 'Resolved') {
            cell.style = {
                backgroundColor: '#90EE90'
            }
        } else if (cell.value == 'Open') {
            cell.style = {
                backgroundColor: '#FF7F7F'
            
            }
        };
    }
);

I need two additional conditions. They are:

  1. When the cell value equals 'In Progress' cell background to equal #FFFFE0
  2. When the cell value equals 'Not Applicable' (a default value when no data has been entered into the relevant field) the cell will be blank or the text will be white to blend the words into the background essentially hiding the words 'Not Applicable'.

Any assistance to decrease the visual clutter for end users would be greatly appreciated.

1 ACCEPTED SOLUTION

TriAnthony
Sisense Team Member
Sisense Team Member

Hi @huffnic,

The script you are using utilizes our Pivot 2.0 API which is for Linux only. You can try the below script for Windows. Let me know if this is helpful.

-Tri

widget.on('ready', function(){
	$('td[class*=p-value] div').map(function(i, cell) {
		switch (cell.innerHTML) {
			case "Resolved": cell.style.backgroundColor='#90EE90';
				break;
			case "Open": cell.style.backgroundColor='#FF7F7F';
				break;
			case "In Progress": cell.style.backgroundColor='#FFFFE0';
				break;
			case "Not Applicable": cell.innerHTML='';
				break;
		}
	}) 
})

 

Tri Anthony Situmorang

View solution in original post

3 REPLIES 3

DRay
Community Team Member
Community Team Member

Hello @huffnic,

Thank you for reaching out here. I see that this question hasn't had a response yet, so I am reaching out internally to try and get you and get you an answer. 

 

David Raynor (DRay)

TriAnthony
Sisense Team Member
Sisense Team Member

Hi @huffnic,

The script you are using utilizes our Pivot 2.0 API which is for Linux only. You can try the below script for Windows. Let me know if this is helpful.

-Tri

widget.on('ready', function(){
	$('td[class*=p-value] div').map(function(i, cell) {
		switch (cell.innerHTML) {
			case "Resolved": cell.style.backgroundColor='#90EE90';
				break;
			case "Open": cell.style.backgroundColor='#FF7F7F';
				break;
			case "In Progress": cell.style.backgroundColor='#FFFFE0';
				break;
			case "Not Applicable": cell.innerHTML='';
				break;
		}
	}) 
})

 

Tri Anthony Situmorang

Thank you!