<?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: Table - Row Colouring - (Splunk 6.x examples app) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Table-Row-Colouring-Splunk-6-x-examples-app/m-p/156399#M43993</link>
    <description>&lt;P&gt;Hi everyone;&lt;/P&gt;

&lt;P&gt;You are not able to get the rows colored because you have some mistakes in your trial.css file:&lt;/P&gt;

&lt;P&gt;In your css file, remove this And it'll work very well.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#highlight tr td {
     background-color: #c1ffc3 !important;
 }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now here was the problem:&lt;BR /&gt;
 You gave background color to you table and after you gave some color to your rows; this make a conflict and it's the raison why there is no rows colored.&lt;/P&gt;</description>
    <pubDate>Mon, 16 Mar 2015 09:26:12 GMT</pubDate>
    <dc:creator>NOUMSSI</dc:creator>
    <dc:date>2015-03-16T09:26:12Z</dc:date>
    <item>
      <title>Table - Row Colouring - (Splunk 6.x examples app)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-Row-Colouring-Splunk-6-x-examples-app/m-p/156395#M43989</link>
      <description>&lt;P&gt;I was just trying to use the same example javascript and css with different search query, but i'm not able to get the rows colored.&lt;BR /&gt;
Please help in this.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Trial.js&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
    'underscore',
    'jquery',
    'splunkjs/mvc',
    'splunkjs/mvc/tableview',
    '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 Age and the State field
            return _(['Age', 'State']).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 number of historical searches
            if (cell.field === 'Age') {
                if (value &amp;gt; 2) {
                    $td.addClass('range-cell').addClass('range-elevated');
                }
            }
            // Apply interpretation for number of realtime searches
            if (cell.field === 'State') {
                if (value &amp;gt; 1) {
                    $td.addClass('range-cell').addClass('range-severe');
                }
            }
            // Update the cell content
    //        $td.text(value.toFixed(2)).addClass('numeric');
        }
    });
    mvc.Components.get('Trial').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).parents('tr').addClass(this.className);
            });
        });
        // Force the table to re-render
        tableView.table.render();
    });
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Trial.css&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/* Row Coloring */
#highlight tr td {
    background-color: #c1ffc3 !important;
}
#highlight tr.range-elevated td {
    background-color: #ffc57a !important;
}
#highlight tr.range-severe td {
    background-color: #d59392 !important;
}
#highlight .table td {
    border-top: 1px solid #fff;
}
#highlight td.range-severe, td.range-elevated {
    font-weight: bold;
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;XML:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard script="Trial.js" stylesheet="Trial.css"&amp;gt;
  &amp;lt;label&amp;gt;Trial&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
      &amp;lt;table id="Trial"&amp;gt;
        &amp;lt;title&amp;gt;Trial&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;source="Trial.csv" host="10.0.255.247" sourcetype="csv"|table Timestamp User Age State&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h&amp;lt;/earliest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&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;option name="count"&amp;gt;10&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;</description>
      <pubDate>Fri, 20 Feb 2015 13:44:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-Row-Colouring-Splunk-6-x-examples-app/m-p/156395#M43989</guid>
      <dc:creator>splunker12er</dc:creator>
      <dc:date>2015-02-20T13:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: Table - Row Colouring - (Splunk 6.x examples app)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-Row-Colouring-Splunk-6-x-examples-app/m-p/156396#M43990</link>
      <description>&lt;P&gt;Also , from the javascript i wanted to know, (from the 35th Block of code)&lt;BR /&gt;
        tableView.table.addCellRenderer(new CustomRangeRenderer());&lt;BR /&gt;
                 tableView.on('rendered', function() {&lt;BR /&gt;
                     // Apply class of the cells to the parent row in order to color the whole row&lt;BR /&gt;
                     tableView.$el.find('td.range-cell').each(function() {&lt;BR /&gt;
                         $(this).parents('tr').addClass(this.className);&lt;BR /&gt;
                     });&lt;/P&gt;

&lt;P&gt;What is 'rendered'  ? Is this common to all examples / I need to modify this ?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Feb 2015 13:45:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-Row-Colouring-Splunk-6-x-examples-app/m-p/156396#M43990</guid>
      <dc:creator>splunker12er</dc:creator>
      <dc:date>2015-02-20T13:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: Table - Row Colouring - (Splunk 6.x examples app)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-Row-Colouring-Splunk-6-x-examples-app/m-p/156397#M43991</link>
      <description>&lt;P&gt;This is very similar to the example data. Even i exported the same example data and just tired it with column name different. But , I am not getting the rows colored. Instead some fields bold&lt;/P&gt;</description>
      <pubDate>Fri, 20 Feb 2015 13:48:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-Row-Colouring-Splunk-6-x-examples-app/m-p/156397#M43991</guid>
      <dc:creator>splunker12er</dc:creator>
      <dc:date>2015-02-20T13:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: Table - Row Colouring - (Splunk 6.x examples app)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-Row-Colouring-Splunk-6-x-examples-app/m-p/156398#M43992</link>
      <description>&lt;P&gt;I'm also interested in this solution, I've tried this before but in the end gave up.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Feb 2015 14:23:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-Row-Colouring-Splunk-6-x-examples-app/m-p/156398#M43992</guid>
      <dc:creator>markthompson</dc:creator>
      <dc:date>2015-02-20T14:23:07Z</dc:date>
    </item>
    <item>
      <title>Re: Table - Row Colouring - (Splunk 6.x examples app)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-Row-Colouring-Splunk-6-x-examples-app/m-p/156399#M43993</link>
      <description>&lt;P&gt;Hi everyone;&lt;/P&gt;

&lt;P&gt;You are not able to get the rows colored because you have some mistakes in your trial.css file:&lt;/P&gt;

&lt;P&gt;In your css file, remove this And it'll work very well.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#highlight tr td {
     background-color: #c1ffc3 !important;
 }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now here was the problem:&lt;BR /&gt;
 You gave background color to you table and after you gave some color to your rows; this make a conflict and it's the raison why there is no rows colored.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2015 09:26:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-Row-Colouring-Splunk-6-x-examples-app/m-p/156399#M43993</guid>
      <dc:creator>NOUMSSI</dc:creator>
      <dc:date>2015-03-16T09:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: Table - Row Colouring - (Splunk 6.x examples app)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-Row-Colouring-Splunk-6-x-examples-app/m-p/156400#M43994</link>
      <description>&lt;P&gt;Hopefully you've already figured out the answer, as I'm about four months late to the party here, but for future reference:&lt;/P&gt;

&lt;P&gt;The reason your rows wouldn't highlight is because your CSS selectors are wrong. Notice that, in the XML, your table has id="Trial". Thus, you need to target #Trial with your CSS selectors, rather than #highlight (as the example uses id="highlight" for its table).&lt;/P&gt;

&lt;P&gt;Fixed CSS (only necessary fix to get row highlighting working):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/* Row Coloring */
 #Trial tr td {
     background-color: #c1ffc3 !important;
 }
 #Trial tr.range-elevated td {
     background-color: #ffc57a !important;
 }
 #Trial tr.range-severe td {
     background-color: #d59392 !important;
 }
 #Trial .table td {
     border-top: 1px solid #fff;
 }
 #Trial td.range-severe, td.range-elevated {
     font-weight: bold;
 }
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Aug 2015 22:07:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-Row-Colouring-Splunk-6-x-examples-app/m-p/156400#M43994</guid>
      <dc:creator>davisja</dc:creator>
      <dc:date>2015-08-03T22:07:02Z</dc:date>
    </item>
  </channel>
</rss>

