Quantcast
Channel: Questions in topic: "splunk-enterprise"
Viewing all articles
Browse latest Browse all 47296

Change color depending on value using javascript with a twist - table column names are not fixed

$
0
0
Hello all, I have below javascript code that I use to change the color of my table cell: require([ 'underscore', 'jquery', 'splunkjs/mvc', 'splunkjs/mvc/tableview', 'splunkjs/mvc/simplexml/ready!' ], function(_, $, mvc, TableView) { var CustomRangeRenderer = TableView.BaseCellRenderer.extend({ canRender: function(cell) { return _(['Performance']).contains(cell.field); }, render: function($td, cell) { var label = cell.value.split("|")[0]; var val = cell.value.split("|")[1]; if(val=="high") { $td.html("
"+label+"
") } else if(val=="low") { $td.html("
"+label+"
") } else if(val=="no") { $td.html("
"+label+"
") } else { $td.html("
"+label+"
") } } }); //List of table IDs to add icon var tableIDs = ["customTable"]; for (i=0;i

Viewing all articles
Browse latest Browse all 47296

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>