<?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 Why am I unable to get Table Cell Highlighting to work with my current XML, CSS, and JavaScript files? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-get-Table-Cell-Highlighting-to-work-with-my/m-p/123026#M33210</link>
    <description>&lt;P&gt;I know there area a bunch of questions about table cell highlighting out there. I have looked at all of them and have tried to get my .js and .css files correct but it will not work.  Please help! I have copied my xml, .js and .css file below. I really appreciate everyone on here answering questions. &lt;/P&gt;

&lt;P&gt;XML&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard script="table_cell_highlighting.js" stylesheet="table_cell_highlighting.css"&amp;gt;
  &amp;lt;label&amp;gt;Application Health Monitor-ZD-Cell Highlight&amp;lt;/label&amp;gt;
  &amp;lt;description&amp;gt;AHM Using Cell Highlight Rangemaps&amp;lt;/description&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;table id="highlight"&amp;gt;
      &amp;lt;title&amp;gt;Application Health Monitor&amp;lt;/title&amp;gt;
      &amp;lt;searchString&amp;gt;tag="BOFC" OR tag="Compass_Asia" OR tag="Compass_Global" OR tag="Datapass_CCNA" OR tag="Datapass_CPS" OR tag="IPM" OR tag="Picasso" OR tag="SAP_APO" OR tag="SAP_CRM_Call_Center" OR tag="SAP_Finance_Logistics" OR tag="SAP_HR" OR tag="SAP_MDMaint" OR tag="SAP_MDMgmt" OR tag="SAP_SRM" OR tag="SAP_eSourcing" OR    tag="SDW" OR tag="Wall_Street" OR tag="myKO_Portal" OR tag="myKO_UCM" LocID="-7" SbuID="-7" |dedup tag | rex field=ResponseDisplay "(?&amp;lt;Application_Response&amp;gt;\d+)" | rex field=AvailabilityDisplay "(?&amp;lt;Application_Availability&amp;gt;\d+)"  |table tag Application_Availability Application_Response |rename tag AS "Application"&amp;lt;/searchString&amp;gt;
      &amp;lt;earliestTime&amp;gt;-30m&amp;lt;/earliestTime&amp;gt;
      &amp;lt;latestTime&amp;gt;now&amp;lt;/latestTime&amp;gt;
      &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
      &amp;lt;option name="count"&amp;gt;20&amp;lt;/option&amp;gt;
      &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
      &amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
      &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
    &amp;lt;/table&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;.JS&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
    'underscore',
    'jquery',
    'splunkjs/mvc',
    'splunkjs/mvc/tableview'A,
    'splunkjs/mvc/simplexml/ready!'
], function(_, $, mvc, TableView) {

     // Row Coloring Example with custom, client-side range interpretation

    var CustomRangeRenderer = TableView.BaseCellRenderer.extend({
        canRender: function(cell) {
            // Enable this custom cell renderer for both the availability and the response field
            return _(['Application_Availability', 'Application_Response']).contains(cell.field);
        },
        render: function($td, cell) {
            // Add a class to the cell based on the returned value
            var value = parseFloat(cell.value);

            // Apply interpretation for availabiliy
            if (cell.field === 'Application_Availability') {
                if (value &amp;lt; 50) {
                    $td.addClass('range-cell').addClass('range-severe');
                }
                else if (value &amp;gt; 50 &amp;amp;&amp;amp; value &amp;lt; 100) {
                    $td.addClass('range-cell').addClass('range-elevated');
                }
                else if (value = 100) {
                    $td.addClass('range-cell').addClass('range-low');
                }
            }

            // Apply interpretation for response
            if (cell.field === 'Application_Response') {
                if (value &amp;lt; 50) {
                    $td.addClass('range-cell').addClass('range-severe');
                }
                else if (value &amp;gt; 50 &amp;amp;&amp;amp; value &amp;lt; 100) {
                    $td.addClass('range-cell').addClass('range-elevated');
                }
                else if (value == 100) {
                    $td.addClass('range-cell').addClass('range-low');
                }
            }

            // Update the cell content
            $td.text(value.toFixed(2)).addClass('numeric');
        }
    });

    mvc.Components.get('highlight').getVisualization(function(tableView) {
        // Add custom cell renderer
        tableView.table.addCellRenderer(new CustomRangeRenderer());
        // tableView.on('rendered', function() {
            // Apply class of the cells to the parent row in order to color the whole row
           // tableView.$el.find('td.range-cell').each(function() {
           //     $(this).addClass(this.className);
           // });
        //});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;.CSS&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/* Cell Highlighting */

/*
#highlight td {
    background-color: #c1ffc3 !important;
}
*/

#highlight td.range-low {
    color: green;
    font-weight: bold;
}

#highlight td.range-elevated {
    background-color: yellow !important;
    font-weight: bold;
}

#highlight td.range-severe {
    background-color: red !important;
    font-weight: bold;
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 15 Jul 2015 03:30:20 GMT</pubDate>
    <dc:creator>zd00191</dc:creator>
    <dc:date>2015-07-15T03:30:20Z</dc:date>
    <item>
      <title>Why am I unable to get Table Cell Highlighting to work with my current XML, CSS, and JavaScript files?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-get-Table-Cell-Highlighting-to-work-with-my/m-p/123026#M33210</link>
      <description>&lt;P&gt;I know there area a bunch of questions about table cell highlighting out there. I have looked at all of them and have tried to get my .js and .css files correct but it will not work.  Please help! I have copied my xml, .js and .css file below. I really appreciate everyone on here answering questions. &lt;/P&gt;

&lt;P&gt;XML&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard script="table_cell_highlighting.js" stylesheet="table_cell_highlighting.css"&amp;gt;
  &amp;lt;label&amp;gt;Application Health Monitor-ZD-Cell Highlight&amp;lt;/label&amp;gt;
  &amp;lt;description&amp;gt;AHM Using Cell Highlight Rangemaps&amp;lt;/description&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;table id="highlight"&amp;gt;
      &amp;lt;title&amp;gt;Application Health Monitor&amp;lt;/title&amp;gt;
      &amp;lt;searchString&amp;gt;tag="BOFC" OR tag="Compass_Asia" OR tag="Compass_Global" OR tag="Datapass_CCNA" OR tag="Datapass_CPS" OR tag="IPM" OR tag="Picasso" OR tag="SAP_APO" OR tag="SAP_CRM_Call_Center" OR tag="SAP_Finance_Logistics" OR tag="SAP_HR" OR tag="SAP_MDMaint" OR tag="SAP_MDMgmt" OR tag="SAP_SRM" OR tag="SAP_eSourcing" OR    tag="SDW" OR tag="Wall_Street" OR tag="myKO_Portal" OR tag="myKO_UCM" LocID="-7" SbuID="-7" |dedup tag | rex field=ResponseDisplay "(?&amp;lt;Application_Response&amp;gt;\d+)" | rex field=AvailabilityDisplay "(?&amp;lt;Application_Availability&amp;gt;\d+)"  |table tag Application_Availability Application_Response |rename tag AS "Application"&amp;lt;/searchString&amp;gt;
      &amp;lt;earliestTime&amp;gt;-30m&amp;lt;/earliestTime&amp;gt;
      &amp;lt;latestTime&amp;gt;now&amp;lt;/latestTime&amp;gt;
      &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
      &amp;lt;option name="count"&amp;gt;20&amp;lt;/option&amp;gt;
      &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
      &amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
      &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
    &amp;lt;/table&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;.JS&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
    'underscore',
    'jquery',
    'splunkjs/mvc',
    'splunkjs/mvc/tableview'A,
    'splunkjs/mvc/simplexml/ready!'
], function(_, $, mvc, TableView) {

     // Row Coloring Example with custom, client-side range interpretation

    var CustomRangeRenderer = TableView.BaseCellRenderer.extend({
        canRender: function(cell) {
            // Enable this custom cell renderer for both the availability and the response field
            return _(['Application_Availability', 'Application_Response']).contains(cell.field);
        },
        render: function($td, cell) {
            // Add a class to the cell based on the returned value
            var value = parseFloat(cell.value);

            // Apply interpretation for availabiliy
            if (cell.field === 'Application_Availability') {
                if (value &amp;lt; 50) {
                    $td.addClass('range-cell').addClass('range-severe');
                }
                else if (value &amp;gt; 50 &amp;amp;&amp;amp; value &amp;lt; 100) {
                    $td.addClass('range-cell').addClass('range-elevated');
                }
                else if (value = 100) {
                    $td.addClass('range-cell').addClass('range-low');
                }
            }

            // Apply interpretation for response
            if (cell.field === 'Application_Response') {
                if (value &amp;lt; 50) {
                    $td.addClass('range-cell').addClass('range-severe');
                }
                else if (value &amp;gt; 50 &amp;amp;&amp;amp; value &amp;lt; 100) {
                    $td.addClass('range-cell').addClass('range-elevated');
                }
                else if (value == 100) {
                    $td.addClass('range-cell').addClass('range-low');
                }
            }

            // Update the cell content
            $td.text(value.toFixed(2)).addClass('numeric');
        }
    });

    mvc.Components.get('highlight').getVisualization(function(tableView) {
        // Add custom cell renderer
        tableView.table.addCellRenderer(new CustomRangeRenderer());
        // tableView.on('rendered', function() {
            // Apply class of the cells to the parent row in order to color the whole row
           // tableView.$el.find('td.range-cell').each(function() {
           //     $(this).addClass(this.className);
           // });
        //});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;.CSS&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/* Cell Highlighting */

/*
#highlight td {
    background-color: #c1ffc3 !important;
}
*/

#highlight td.range-low {
    color: green;
    font-weight: bold;
}

#highlight td.range-elevated {
    background-color: yellow !important;
    font-weight: bold;
}

#highlight td.range-severe {
    background-color: red !important;
    font-weight: bold;
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Jul 2015 03:30:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-get-Table-Cell-Highlighting-to-work-with-my/m-p/123026#M33210</guid>
      <dc:creator>zd00191</dc:creator>
      <dc:date>2015-07-15T03:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to get Table Cell Highlighting to work with my current XML, CSS, and JavaScript files?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-get-Table-Cell-Highlighting-to-work-with-my/m-p/123027#M33211</link>
      <description>&lt;P&gt;Did you make sure that your .js and .css files are loaded on the dashboard? You can confirm this with your browser, usually pressing F12 to get the tools.&lt;BR /&gt;
Right-click on your table cell you would like to see colored and select "inspect element" (or similar). This should directly take you to the element in the DOM, and you should see that the cells have the class like "range-severe" as you specified in the .js code. That view should also tell you which .css styles are applied to this item and from which source.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2015 09:18:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-get-Table-Cell-Highlighting-to-work-with-my/m-p/123027#M33211</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-07-16T09:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to get Table Cell Highlighting to work with my current XML, CSS, and JavaScript files?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-get-Table-Cell-Highlighting-to-work-with-my/m-p/123028#M33212</link>
      <description>&lt;P&gt;I do not believe that my .js and .css are loading into the dashboard. Do you think that restarting splunk could do it?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2015 12:43:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-get-Table-Cell-Highlighting-to-work-with-my/m-p/123028#M33212</guid>
      <dc:creator>zd00191</dc:creator>
      <dc:date>2015-07-16T12:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to get Table Cell Highlighting to work with my current XML, CSS, and JavaScript files?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-get-Table-Cell-Highlighting-to-work-with-my/m-p/123029#M33213</link>
      <description>&lt;P&gt;When adding custom JS and CSS to a Simple XML dashboard, Splunk MUST be restarted for those to be pulled into the dashboard.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2015 12:56:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-get-Table-Cell-Highlighting-to-work-with-my/m-p/123029#M33213</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2015-07-16T12:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to get Table Cell Highlighting to work with my current XML, CSS, and JavaScript files?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-get-Table-Cell-Highlighting-to-work-with-my/m-p/123030#M33214</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Splunkweb&lt;/STRONG&gt; that is &lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2015 16:18:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-get-Table-Cell-Highlighting-to-work-with-my/m-p/123030#M33214</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-07-16T16:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to get Table Cell Highlighting to work with my current XML, CSS, and JavaScript files?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-get-Table-Cell-Highlighting-to-work-with-my/m-p/123031#M33215</link>
      <description>&lt;P&gt;As mentioned in the answer, YES &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; That's also stated in every documentation there is on using css in dashboards, and usually suggested as the first solution in any answer to this topic... it surprises me that you didn't come across this.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jul 2015 08:41:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-get-Table-Cell-Highlighting-to-work-with-my/m-p/123031#M33215</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-07-17T08:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to get Table Cell Highlighting to work with my current XML, CSS, and JavaScript files?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-get-Table-Cell-Highlighting-to-work-with-my/m-p/123032#M33216</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Most of the examples I see are related to highlight a numeric cell. What if I want to highlight a date or a string, such as OK or ERROR?&lt;/P&gt;

&lt;P&gt;From the js script:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;        // Update the cell content
        $td.text(value.toFixed(2)).addClass('numeric');
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Should this change too?&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2016 09:11:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-get-Table-Cell-Highlighting-to-work-with-my/m-p/123032#M33216</guid>
      <dc:creator>robettinger</dc:creator>
      <dc:date>2016-08-05T09:11:51Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to get Table Cell Highlighting to work with my current XML, CSS, and JavaScript files?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-get-Table-Cell-Highlighting-to-work-with-my/m-p/123033#M33217</link>
      <description>&lt;P&gt;I am not able to get this to work either in Splunk Ent 7.1 with text values.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 19:07:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-get-Table-Cell-Highlighting-to-work-with-my/m-p/123033#M33217</guid>
      <dc:creator>Cuyose</dc:creator>
      <dc:date>2018-08-28T19:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to get Table Cell Highlighting to work with my current XML, CSS, and JavaScript files?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-get-Table-Cell-Highlighting-to-work-with-my/m-p/123034#M33218</link>
      <description>&lt;P&gt;@robettinger If you want to highlight text or string values in table cell, Then you need to add the following code. &lt;/P&gt;

&lt;P&gt;// Update the cell content&lt;BR /&gt;
$td.text(value).addClass('string');&lt;/P&gt;

&lt;P&gt;I have tried it in my case and it works. &lt;/P&gt;

&lt;P&gt;Please let me know if you encounter any other problems. &lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2019 17:40:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-get-Table-Cell-Highlighting-to-work-with-my/m-p/123034#M33218</guid>
      <dc:creator>sandyIscream</dc:creator>
      <dc:date>2019-04-10T17:40:09Z</dc:date>
    </item>
  </channel>
</rss>

