cancel
Showing results for 
Search instead for 
Did you mean: 

Linux pivot2 - how to replace null with '-'

cglowe
8 - Cloud Apps
8 - Cloud Apps

In Windows, with pivot1, we were using the following script to replace null values with a dash (-).  We've moved to Linux and are aware the script will not work.  What script should we use to accomplish the same replacement?

Old script:

widget.on('ready', function(){
$('td[class*=p-value] div').map(function(i, cell) {
if(cell.innerHTML == " " ) cell.innerHTML="-";
})
})

1 ACCEPTED SOLUTION

harikm007
12 - Data Integration
12 - Data Integration

@cglowe ,

Please check if this script works for you : 

widget.on('ready', function(){
	$('div[class*=table-grid__content__inner]').map(function(i, cell) {
		if(cell.innerHTML == " " || cell.innerHTML == "") cell.innerHTML="-"; //change the condition based on requirement
	})
})

-Hari

 

View solution in original post

2 REPLIES 2

harikm007
12 - Data Integration
12 - Data Integration

@cglowe ,

Please check if this script works for you : 

widget.on('ready', function(){
	$('div[class*=table-grid__content__inner]').map(function(i, cell) {
		if(cell.innerHTML == " " || cell.innerHTML == "") cell.innerHTML="-"; //change the condition based on requirement
	})
})

-Hari

 

harikm007
12 - Data Integration
12 - Data Integration

Another solution is to use Pivot2 API : 

widget.transformPivot(
    {
        type: ['value']
    },
    function setCellBackground(metadata, cell) {
        if(cell.content.trim() == '')
			cell.content = '-'
    }
)

-Hari