Adding an Exclamation Mark to Cells with Large Numbers

From Q
Jump to: navigation, search
// Display an exclamation point next to the first statistic in each cell, if it is over 80.

// Get the values for the first statistic shown on the table.
var values = table.get(table.statistics[0]);

// Get the default text in each cell in the table.
var cell_texts = table.cellText;

// Loop through each cell...
for (var row = 0; row < table.numberRows; row++)
	for (var column = 0; column < table.numberColumns; column++) {
		var value = values[row][column];
		if (value > 80) {
			// Put an exclamation point next to the first statistic.
			cell_texts[row][column] = ['!'];
		}
	}
	
// Now store the new cell texts.
table.cellText = cell_texts;

See also