I've very similar javascript as below in my dashboard which adds up the color in the table. As I've updated dashboard.css I cannot utilize XML color palette, so I had to use table cell renderer.
require([
'underscore',
'jquery',
'splunkjs/mvc',
'splunkjs/mvc/tableview',
'splunkjs/mvc/simplexml/ready!'
], function(_, $, mvc, TableView) {
var CustomRangeRenderer = TableView.BaseCellRenderer.extend({
canRender: function(cell) {
// Point-C
return _(['My Column Name', 'Name']).contains(cell.field);
},
render: function($td, cell) {
// Point-D
if(cell.value=="red" || cell.value=="green" || cell.value=="yellow")
{
$td.html("")
}
else if(cell.value=="NoData" || cell.value=="null")
{
$td.html("")
}
else
{
$td.html("
"+cell.value+"
")
}
}
});
//List of table IDs to add icon
var tableIDs = ["Mytable1", "Mytable2"];
for (i=0;i