<?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 Table: Using custom inline icons for multiple fields in a table (multiple columns) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Table-Using-custom-inline-icons-for-multiple-fields-in-a-table/m-p/126518#M34259</link>
    <description>&lt;P&gt;I have the follinwg code from my .js file&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var CustomIconRenderer = TableView.BaseCellRenderer.extend({
            canRender: function(cell) {
                return cell.field === 'Application_Availability';
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If I want to add inline icons for multiple fields a my table, how do I get the custom icon renderer to read both Application_Availability column and the Application_Response column. Should it look like the code below? Please help. Thanks!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var CustomIconRenderer = TableView.BaseCellRenderer.extend({
            canRender: function(cell) {
                return cell.field === 'Application_Availability', 'Application_Response';
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 29 Sep 2020 06:43:23 GMT</pubDate>
    <dc:creator>zd00191</dc:creator>
    <dc:date>2020-09-29T06:43:23Z</dc:date>
    <item>
      <title>Table: Using custom inline icons for multiple fields in a table (multiple columns)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-Using-custom-inline-icons-for-multiple-fields-in-a-table/m-p/126518#M34259</link>
      <description>&lt;P&gt;I have the follinwg code from my .js file&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var CustomIconRenderer = TableView.BaseCellRenderer.extend({
            canRender: function(cell) {
                return cell.field === 'Application_Availability';
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If I want to add inline icons for multiple fields a my table, how do I get the custom icon renderer to read both Application_Availability column and the Application_Response column. Should it look like the code below? Please help. Thanks!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var CustomIconRenderer = TableView.BaseCellRenderer.extend({
            canRender: function(cell) {
                return cell.field === 'Application_Availability', 'Application_Response';
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:43:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-Using-custom-inline-icons-for-multiple-fields-in-a-table/m-p/126518#M34259</guid>
      <dc:creator>zd00191</dc:creator>
      <dc:date>2020-09-29T06:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: Table: Using custom inline icons for multiple fields in a table (multiple columns)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-Using-custom-inline-icons-for-multiple-fields-in-a-table/m-p/126519#M34260</link>
      <description>&lt;P&gt;You need to set a proper conditional statement.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var CustomIconRenderer = TableView.BaseCellRenderer.extend({
         canRender: function(cell) {
               var allowedCells = ["Application_Availability","Application_Response" ];
              return (allowedCells.indexOf(cell.field) &amp;gt; -1 ) ;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It will take the field name &lt;CODE&gt;cell.field&lt;/CODE&gt;, and see if it is located in the array &lt;CODE&gt;allowedCells&lt;/CODE&gt;. Update that array to whatever field names apply. If it finds it, it will return &lt;CODE&gt;true&lt;/CODE&gt;, if not, it will return &lt;CODE&gt;false&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2015 19:02:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-Using-custom-inline-icons-for-multiple-fields-in-a-table/m-p/126519#M34260</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2015-07-16T19:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: Table: Using custom inline icons for multiple fields in a table (multiple columns)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-Using-custom-inline-icons-for-multiple-fields-in-a-table/m-p/126520#M34261</link>
      <description>&lt;P&gt;You can skip the ternary operator like so:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;return allowedCells.indexOf(cell.field) &amp;gt; -1;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Jul 2015 21:03:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-Using-custom-inline-icons-for-multiple-fields-in-a-table/m-p/126520#M34261</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2015-07-16T21:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Table: Using custom inline icons for multiple fields in a table (multiple columns)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-Using-custom-inline-icons-for-multiple-fields-in-a-table/m-p/126521#M34262</link>
      <description>&lt;P&gt;bah, you are correct sir. changed!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jul 2015 11:12:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-Using-custom-inline-icons-for-multiple-fields-in-a-table/m-p/126521#M34262</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2015-07-17T11:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: Table: Using custom inline icons for multiple fields in a table (multiple columns)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-Using-custom-inline-icons-for-multiple-fields-in-a-table/m-p/126522#M34263</link>
      <description>&lt;P&gt;You've basically implemented &lt;CODE&gt;if true then true else false endif&lt;/CODE&gt; &lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jul 2015 11:30:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-Using-custom-inline-icons-for-multiple-fields-in-a-table/m-p/126522#M34263</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2015-07-17T11:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: Table: Using custom inline icons for multiple fields in a table (multiple columns)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-Using-custom-inline-icons-for-multiple-fields-in-a-table/m-p/126523#M34264</link>
      <description>&lt;P&gt;I am having issues getting this to work. I have copied my .js and .css files below. I triple checked them but may be I missed something. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; require([
        'underscore',
        'jquery',
        'splunkjs/mvc',
        'splunkjs/mvc/tableview',
        'splunkjs/mvc/simplexml/ready!'
    ], function(_, $, mvc, TableView) {

        var CustomIconRenderer = TableView.BaseCellRenderer.extend({
            canRender: function(cell) {
              var allowedCells = ["Application_Availability","Application_Response"]          return (allowedCells.indexOf(cell.field)) &amp;gt; -1;
            },

             render: function($td, cell) {
                var count = cell.value;

                // Compute the icon base on the field value
                var icon;
                if(count &amp;lt;= 50) {
                    icon = 'severe';
                } else if(count &amp;gt; 50 &amp;amp;&amp;amp; count &amp;lt; 100) {
                    icon = 'elevated';
                } else if(count == 100) {
                    icon = 'low';
                } else {
                    icon='none';
                }

                // Create the icon element and add it to the table cell
                $td.addClass('icon-inline numeric').html(_.template('&amp;lt;%- text %&amp;gt; &amp;lt;i class="icon-&amp;lt;%-icon%&amp;gt;"&amp;gt;&amp;lt;/i&amp;gt;', {
                    icon: icon,
                    text: cell.value
                }));
            }
        });

        mvc.Components.get('table1').getVisualization(function(tableView){
            // Register custom cell renderer
            tableView.table.addCellRenderer(new CustomIconRenderer());
            // Force the table to re-render
            tableView.table.render();
        });
    });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;.css=====================================================&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/* Custom Icons */

td.icon {
    text-align: center;
}

td.icon i {
    font-size: 25px;
    text-shadow: 1px 1px #aaa;
}

td.icon .severe {
    color: red;
}

td.icon .elevated {
    color: yellow;
}

td.icon .low {
    color: #006400;
}

/* 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;
}

.icon-inline i {
    font-size: 18px;
    margin-left: 5px;
}
.icon-inline i.icon-severe {
    color: #ef392c;
}
.icon-inline i.icon-elevated {
    color: #ff9c1a;
}
.icon-inline i.icon-low {
    color: #5fff5e;
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 Jul 2015 17:38:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-Using-custom-inline-icons-for-multiple-fields-in-a-table/m-p/126523#M34264</guid>
      <dc:creator>zd00191</dc:creator>
      <dc:date>2015-07-18T17:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: Table: Using custom inline icons for multiple fields in a table (multiple columns)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-Using-custom-inline-icons-for-multiple-fields-in-a-table/m-p/126524#M34265</link>
      <description>&lt;P&gt;I tried using this but no icons are showing up. I have my .js and .css below. Could you please take a look? Thank you so much!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jul 2015 02:03:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-Using-custom-inline-icons-for-multiple-fields-in-a-table/m-p/126524#M34265</guid>
      <dc:creator>zd00191</dc:creator>
      <dc:date>2015-07-21T02:03:37Z</dc:date>
    </item>
  </channel>
</rss>

