Showing results for 
Search instead for 
Did you mean: 

How to apply javascript to all pages of a table

8 - Cloud Apps
8 - Cloud Apps

I have the following script that modifies the values within a couple columns in this table widget and it works just fine. The issue I am having is it only applies to the first page of the table, and as soon as I change the page the changes are no longer applied. Is there an event associated with changing pages of a table I can set up in the script to make sure it runs when pages are changed? 

Thanks in advance. 



widget.on('domready', function(se, ev) {
	var tableObject = document.getElementById("grid");
	for (var r = 1, n = tableObject.rows.length; r < n; r++) {
		if (tableObject.rows[r].cells[5].innerHTML == 1){
			tableObject.rows[r].cells[5].innerHTML = "True";
			tableObject.rows[r].cells[5].innerHTML = "False";
		if (tableObject.rows[r].cells[6].innerHTML == 1){
			tableObject.rows[r].cells[6].innerHTML = "True";
			tableObject.rows[r].cells[6].innerHTML = "False";





Sisense Team Member
Sisense Team Member

Hi @jfarmer - is your Sisense instance running on Windows or Linux? If you're unsure, please refer to this article on how to check: Check whether running Sisense on Linux or Windows

Based on that info, we can give you more specifics.


Katie G | Sisense Pre-Sales Solutions Architect

It is running on Linux, Sisense hosted. Also this is a table widget type object, not a pivot2 object if that helps. 

Sisense Team Member
Sisense Team Member

Hi @jfarmer , spent some time testing and I did not find a script solution that worked super well. 

Some of the limitations to a script solution I found:

  • Going from a numeric data type to a string data type in a table widget (value 1 to "True") did not seem to work - only worked if the data type was the same (numeric to numeric)
  • The native widget event to put the logic behind ("processcell") does not fire for every page of results - just the first 10 or so pages

The script that somewhat worked (but again has the limits above, I don't recommend using it as is)

// list of column names to apply logic to
let columnTitleList = ['Column5', 'Column6']

widget.on('processcell', function(ev, widget){
if( === 1){ = 50000
else { = 60000

I think we can get the result you are looking for via a different method:


If this is a regular table:

I recommend you add a custom column in the Elasticube model that contains the True or False logic and use those columns in the table widget as is - 



Before model changes:


After model changes:


If this is a table with aggregation:

Unless there is a specific reason to use the table w/agg, switch the type to pivot table. Then you can use this script below (uses newer Pivot 2 API):

// List Value names
let colList = ["Value4", "Value5"]

type: ['value']
function (metadata, cell) {
if(cell.value === "1"){
cell.content= "True"
else {
cell.content= "False"

Before script:


After script:


Hope that helps!

Katie G | Sisense Pre-Sales Solutions Architect