<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Color individual table cell based on value in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81836#M5237</link>
    <description>&lt;P&gt;Actually, the particular answer we're commentiog on here will not work.  The HTML of the modules is not on the page when application.js is loaded, and to do any custom JS here properly you have to do more work that is missing from this code sample, to basically patch/insert yourself into the rendering logic of the module.&lt;/P&gt;</description>
    <pubDate>Fri, 04 Oct 2013 20:42:25 GMT</pubDate>
    <dc:creator>nick</dc:creator>
    <dc:date>2013-10-04T20:42:25Z</dc:date>
    <item>
      <title>Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81823#M5224</link>
      <description>&lt;P&gt;I know that I can color an entire row using the table rowClass param in Sideview like so&lt;BR /&gt;&lt;BR /&gt;
&lt;CODE&gt;&amp;lt;param name="rowClass"&amp;gt;$row.fields.range$&amp;lt;/param&amp;gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;
and then creating custom css&lt;BR /&gt;&lt;BR /&gt;
&lt;CODE&gt;.Table tr.high td {&lt;BR /&gt;
    background-color:#e67918;&lt;BR /&gt;
    color:#fff;&lt;BR /&gt;
}&lt;/CODE&gt;&lt;BR /&gt;
but is there a way to color an individual cell based on a value?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Edit&lt;/STRONG&gt;: To expand this question based on the below answers by gpradeepkumarreddy&lt;/P&gt;

&lt;P&gt;I think I am missing something. Based on the suggestions below I have the following javascript in &lt;CODE&gt;/apps/MyApp/appserver/static/application.js&lt;/CODE&gt; but I do not see any classes added to the table.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if ((Splunk.util.getCurrentView() == "live_dashboard") &amp;amp;&amp;amp; Splunk.Module.SimpleResultsTable) {
Splunk.Module.SimpleResultsTable = $.klass(Splunk.Module.SimpleResultsTable, {
    onResultsRendered: function($super) {
        var retVal = $super();

this.myCustomHeatMapDecorator();
        return retVal;
    },

myCustomHeatMapDecorator: function () {

//Your code goes here
var sessions = (tds[1].innerText) ? tds[1].innerText : tds[1].textContent;
    if(sessions&amp;gt;1000){ //threshold to color
        {
        tr.find("td:nth-child(2)").addClass("colorRed"); //colorRed is a custom css class for a table cell
        }
    }
//end

}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Oct 2013 14:57:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81823#M5224</guid>
      <dc:creator>sc0tt</dc:creator>
      <dc:date>2013-10-03T14:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81824#M5225</link>
      <description>&lt;P&gt;You can achieve this by having custom java script code in application.js &lt;PRE&gt;my_app/appserver/static/js/application.js&lt;/PRE&gt;&lt;/P&gt;

&lt;PRE&gt;var text = (tds[0].innerText) ? tds[0].innerText : tds[0].textContent;&lt;/PRE&gt;.

&lt;PRE&gt;
if(text&amp;gt;10){ //threshold to color
{
tr.find("td:nth-child(1)").addClass("colorRed"); //colorRed is a custom css class for a table cell
}
&lt;/PRE&gt;

&lt;PRE&gt;
application.css

td.colorRed{
    background-color:#CC3333;
    color: #000000;
    text-align: center 
}
&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Oct 2013 15:40:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81824#M5225</guid>
      <dc:creator>pradeepkumarg</dc:creator>
      <dc:date>2013-10-03T15:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81825#M5226</link>
      <description>&lt;P&gt;Sure, check out this answer: &lt;A href="http://answers.splunk.com/answers/83206/color-in-a-table-based-on-values"&gt;http://answers.splunk.com/answers/83206/color-in-a-table-based-on-values&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;Its pretty easy, just drop a bit of Javascript, then do your rendering via stylesheets.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 06:08:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81825#M5226</guid>
      <dc:creator>LukeMurphey</dc:creator>
      <dc:date>2013-10-04T06:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81826#M5227</link>
      <description>&lt;P&gt;Thanks, I'll check this method out as well.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 06:28:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81826#M5227</guid>
      <dc:creator>sc0tt</dc:creator>
      <dc:date>2013-10-04T06:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81827#M5228</link>
      <description>&lt;P&gt;Many thanks. However, I'm having some trouble getting this to work. What does the "nth-child(1)" refer to?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 16:06:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81827#M5228</guid>
      <dc:creator>sc0tt</dc:creator>
      <dc:date>2013-10-04T16:06:45Z</dc:date>
    </item>
    <item>
      <title>Re: Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81828#M5229</link>
      <description>&lt;P&gt;I'm unable to get the application.js to load. I have it in &lt;CODE&gt;my_app/appserver/static/js/application.js&lt;/CODE&gt; and I've restarted splunkweb. Any ideas?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 17:38:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81828#M5229</guid>
      <dc:creator>sc0tt</dc:creator>
      <dc:date>2013-10-04T17:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81829#M5230</link>
      <description>&lt;P&gt;I was able to get this to work as described, thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 17:40:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81829#M5230</guid>
      <dc:creator>sc0tt</dc:creator>
      <dc:date>2013-10-04T17:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81830#M5231</link>
      <description>&lt;PRE&gt;
if ((Splunk.util.getCurrentView() == "my_view") &amp;amp;&amp;amp; Splunk.Module.SimpleResultsTable) {
    Splunk.Module.SimpleResultsTable = $.klass(Splunk.Module.SimpleResultsTable, {
        onResultsRendered: function($super) {
            var retVal = $super();
            
            this.myCustomHeatMapDecorator();
            return retVal;
        },      
            
myCustomHeatMapDecorator: function () {

//Your code goes here

}
&lt;/PRE&gt;

&lt;P&gt;Make sure you refer your current view in the place of my_view&lt;/P&gt;

&lt;P&gt;&lt;PRE&gt; nth-child(1) &lt;/PRE&gt; is the first td element in a given tr&lt;/P&gt;

&lt;P&gt;You'll have to modify that based on your need.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 18:33:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81830#M5231</guid>
      <dc:creator>pradeepkumarg</dc:creator>
      <dc:date>2013-10-04T18:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81831#M5232</link>
      <description>&lt;P&gt;SplunkWeb only really looks on the filesystem for application.js when it's restarted.  If there is one there when it restarts, it will try and serve it.  If there was not one there when it restarted last, it will steadfastly ignore it.   So I think just restart SplunkWeb and your code will start getting loaded.  Also note that restarting just splunkweb (&lt;CODE&gt;splunk restart splunkweb&lt;/CODE&gt;) will not cause anyone to lose auth.  In fact the interruption in connectivity will be so brief that most users probably wont even notice it.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 18:41:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81831#M5232</guid>
      <dc:creator>nick</dc:creator>
      <dc:date>2013-10-04T18:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81832#M5233</link>
      <description>&lt;P&gt;I have the same question as sc0tt, but I was unable to successfully implement this answer. It it compatible with Sideview's Table module? I tried replacing every instance of SimpleResultsTable with Table to no avail. Are there any other substitutions I would need to make?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 20:23:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81832#M5233</guid>
      <dc:creator>nlapier2</dc:creator>
      <dc:date>2013-10-04T20:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81833#M5234</link>
      <description>&lt;P&gt;@nlapier2: which version of Splunk are you using?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 20:31:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81833#M5234</guid>
      <dc:creator>LukeMurphey</dc:creator>
      <dc:date>2013-10-04T20:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81834#M5235</link>
      <description>&lt;P&gt;I haven't been able to get this solution working. If I just have tr.addClass("colorRed"), it will work as specified and color the entire row red. But when I add in the "td:nth-child(x)" to make tr.find("td:nth-child(x)").addClass("colorRed") it doesn't highlight anything. Am I missing something?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 20:31:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81834#M5235</guid>
      <dc:creator>nlapier2</dc:creator>
      <dc:date>2013-10-04T20:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81835#M5236</link>
      <description>&lt;P&gt;Version 6.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 20:33:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81835#M5236</guid>
      <dc:creator>nlapier2</dc:creator>
      <dc:date>2013-10-04T20:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81836#M5237</link>
      <description>&lt;P&gt;Actually, the particular answer we're commentiog on here will not work.  The HTML of the modules is not on the page when application.js is loaded, and to do any custom JS here properly you have to do more work that is missing from this code sample, to basically patch/insert yourself into the rendering logic of the module.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 20:42:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81836#M5237</guid>
      <dc:creator>nick</dc:creator>
      <dc:date>2013-10-04T20:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81837#M5238</link>
      <description>&lt;P&gt;Yes, the custom JS solution here is tailored just for the SimpleResultsTable module.   Sit tight and I will write back soon with an official answer to do this with Table and a customBehavior thereupon.  Actually there is a whole feature to do this in Table coming, with no custom code, but that won't release until at least Sideview Utils 3.0 so pretend I didn't say anything.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 20:43:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81837#M5238</guid>
      <dc:creator>nick</dc:creator>
      <dc:date>2013-10-04T20:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81838#M5239</link>
      <description>&lt;P&gt;Thanks, really appreciate it.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 20:47:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81838#M5239</guid>
      <dc:creator>nlapier2</dc:creator>
      <dc:date>2013-10-04T20:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81839#M5240</link>
      <description>&lt;P&gt;@nlapier2 I am using Version 6 as well. I had to modify the CSS to get it to work.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;.SimpleResultsTable table.simpleResultsTable  tr td[field="range"][data-value="high"] {&lt;BR /&gt;
    background-color: #C42323;&lt;BR /&gt;
    color: #CCCCCC;&lt;BR /&gt;
    font-weight: bold;&lt;BR /&gt;
}&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;@nick is it possible to do this based on numerical comparisons as well (ie data-value&amp;gt;"100")?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 22:20:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81839#M5240</guid>
      <dc:creator>sc0tt</dc:creator>
      <dc:date>2013-10-04T22:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81840#M5241</link>
      <description>&lt;P&gt;So the method described by gpradeepkumarreddy will not work unless I modify the Sideview table module?&lt;/P&gt;</description>
      <pubDate>Sat, 05 Oct 2013 09:13:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81840#M5241</guid>
      <dc:creator>sc0tt</dc:creator>
      <dc:date>2013-10-05T09:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81841#M5242</link>
      <description>&lt;P&gt;The earlier code sample posted is a rough sketch of the sort of code to use. And the example posted later using customHeatMapDecorator will only work with SimpleResultsTable, NOT Table.  In the next version of Sideview Utils you will be able to give your Table modules: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&amp;lt;param name="columns.myFieldName.class"&amp;gt;$myClassField$&amp;lt;/param&amp;gt;&lt;BR /&gt;
&amp;lt;param name="hiddenFields"&amp;gt;myClassField&amp;lt;/param&amp;gt;&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;and then the "myFieldName" column will get the value of the myClassField field as a class. You won't need any custom javascript at all.  Can you wait a week or two? I can also email you a tar to use as a beta.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Oct 2013 15:39:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81841#M5242</guid>
      <dc:creator>nick</dc:creator>
      <dc:date>2013-10-05T15:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: Color individual table cell based on value</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81842#M5243</link>
      <description>&lt;P&gt;Thanks for the clarification. It sounds like the new Table modules will be a very welcomed feature. A beta version of it would be awesome.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Oct 2013 16:15:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Color-individual-table-cell-based-on-value/m-p/81842#M5243</guid>
      <dc:creator>sc0tt</dc:creator>
      <dc:date>2013-10-05T16:15:30Z</dc:date>
    </item>
  </channel>
</rss>

