<?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: Splunk 6.x Dashboard Examples: How to include multiple ID's for different tables (inline icon) in javascript? in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182461#M18031</link>
    <description>&lt;P&gt;and of course the &lt;BR /&gt;
  });&lt;/P&gt;

&lt;P&gt;after each mvc.Components table def &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 24 Mar 2015 10:02:15 GMT</pubDate>
    <dc:creator>baerts</dc:creator>
    <dc:date>2015-03-24T10:02:15Z</dc:date>
    <item>
      <title>Splunk 6.x Dashboard Examples: How to include multiple ID's for different tables (inline icon) in javascript?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182457#M18027</link>
      <description>&lt;P&gt;Need your help to find the right javascript codes of inline icons under dashboard examples. Need to know how to use multiple ID's for this setup. I understand i need to include the ID name on .xml, but what is the right code for .js?&lt;/P&gt;

&lt;P&gt;This is only limited to a single "Table1" ID. how can i include other table ID's (e.g Table2, Table3,etc)?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; 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;</description>
      <pubDate>Mon, 23 Mar 2015 08:06:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182457#M18027</guid>
      <dc:creator>jonathan_yan5</dc:creator>
      <dc:date>2015-03-23T08:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk 6.x Dashboard Examples: How to include multiple ID's for different tables (inline icon) in javascript?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182458#M18028</link>
      <description>&lt;P&gt;Hi Jonathan,&lt;BR /&gt;
I don't know if this will help you, but I'll like to help you more.&lt;BR /&gt;
If I have understood well, you need the right javascript codes of inline icons under dashboard examples, in the simple_xml_examples you can choose &lt;CODE&gt;Table Icon Set (Inline)&lt;/CODE&gt;for the good application that you need. Below is the right code for .js:&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) {
            return cell.field === 'count';
        },
        render: function($td, cell) {
            var count = cell.value;

            // Compute the icon base on the field value
            var icon;
            if(count &amp;gt; 3000) {
                icon = 'alert-circle';
            } else if(count &amp;gt; 1000) {
                icon = 'alert';
            } else {
                icon = 'check';
            }

            // 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;You can found this &lt;CODE&gt;table_icons_inline.js&lt;/CODE&gt; in the link below in your local machine if you have intalled simple_xml_examples app:&lt;BR /&gt;
&lt;A href="http://++$Splunk_home$etcappssimple_xml_examplesappserverstatic" target="_blank"&gt;  $Splunk_home$\etc\apps\simple_xml_examples\appserver\static&lt;/A&gt; then follow the below link in splunk web for simple xml code:&lt;BR /&gt;
&lt;A href="http:/en-US/app/simple_xml_examples/custom_table_icon_set_inline?earliest=0&amp;amp;latest=" target="_blank"&gt;/en-US/app/simple_xml_examples/custom_table_icon_set_inline?earliest=0&amp;amp;latest=&lt;/A&gt;&lt;BR /&gt;
Please let me know if you have more suggestion. Thanks and regards&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:16:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182458#M18028</guid>
      <dc:creator>Patient</dc:creator>
      <dc:date>2020-09-28T19:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk 6.x Dashboard Examples: How to include multiple ID's for different tables (inline icon) in javascript?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182459#M18029</link>
      <description>&lt;P&gt;Hello Patient, i am already aware of that script.. problem is i have three tables.. that script i believe does not support 3 table ID's.. if it does can you revise that script to show the right codes. Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2015 15:09:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182459#M18029</guid>
      <dc:creator>jonathan_yan5</dc:creator>
      <dc:date>2015-03-23T15:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk 6.x Dashboard Examples: How to include multiple ID's for different tables (inline icon) in javascript?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182460#M18030</link>
      <description>&lt;P&gt;You can add the following to the javascript for each table needed:&lt;/P&gt;

&lt;P&gt;mvc.Components.get('table2').getVisualization(function(tableView){&lt;BR /&gt;
         // Register custom cell renderer&lt;BR /&gt;
         tableView.table.addCellRenderer(new CustomIconRenderer());&lt;BR /&gt;
         // Force the table to re-render&lt;BR /&gt;
         tableView.table.render();&lt;/P&gt;

&lt;P&gt;mvc.Components.get('table3').getVisualization(function(tableView){&lt;BR /&gt;
         // Register custom cell renderer&lt;BR /&gt;
         tableView.table.addCellRenderer(new CustomIconRenderer());&lt;BR /&gt;
         // Force the table to re-render&lt;BR /&gt;
         tableView.table.render();&lt;/P&gt;

&lt;P&gt;etc.&lt;/P&gt;

&lt;P&gt;and use these as your additional table id's in the dashboard&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2015 10:00:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182460#M18030</guid>
      <dc:creator>baerts</dc:creator>
      <dc:date>2015-03-24T10:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk 6.x Dashboard Examples: How to include multiple ID's for different tables (inline icon) in javascript?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182461#M18031</link>
      <description>&lt;P&gt;and of course the &lt;BR /&gt;
  });&lt;/P&gt;

&lt;P&gt;after each mvc.Components table def &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2015 10:02:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182461#M18031</guid>
      <dc:creator>baerts</dc:creator>
      <dc:date>2015-03-24T10:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk 6.x Dashboard Examples: How to include multiple ID's for different tables (inline icon) in javascript?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182462#M18032</link>
      <description>&lt;P&gt;Hello baerts, have you tried to use your suggestion? actually i have tried that before but it did not work.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2015 10:10:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182462#M18032</guid>
      <dc:creator>jonathan_yan5</dc:creator>
      <dc:date>2015-03-25T10:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk 6.x Dashboard Examples: How to include multiple ID's for different tables (inline icon) in javascript?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182463#M18033</link>
      <description>&lt;P&gt;Jonathan hi!&lt;/P&gt;

&lt;P&gt;Yes and it did work also :-). If I remember correctly:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;I needed to restart spunk (but am not sure anymore on that)&lt;/LI&gt;
&lt;LI&gt;You need to use all table-id's you defined in your javascript in the dashboard.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;gr.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2015 12:50:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182463#M18033</guid>
      <dc:creator>baerts</dc:creator>
      <dc:date>2015-03-25T12:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk 6.x Dashboard Examples: How to include multiple ID's for different tables (inline icon) in javascript?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182464#M18034</link>
      <description>&lt;P&gt;Hello! you can attain your objective by simply assign for each table, his own &lt;STRONG&gt;js file&lt;/STRONG&gt;. something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard script="table_icons_inline1.js,table_icons_inline2.js" stylesheet="table_decoration_icon.css"&amp;gt;
    &amp;lt;label&amp;gt;Table Icon Set (Inline)&amp;lt;/label&amp;gt;
    &amp;lt;row&amp;gt;
        &amp;lt;table id="table1"&amp;gt;
            &amp;lt;title&amp;gt;Render Icons based on rangemap result&amp;lt;/title&amp;gt;
            &amp;lt;searchString&amp;gt;index=_internal | stats count by sourcetype,source,host&amp;lt;/searchString&amp;gt;
            &amp;lt;earliestTime&amp;gt;-1h&amp;lt;/earliestTime&amp;gt;
            &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;/table&amp;gt;
    &amp;lt;/row&amp;gt;
   &amp;lt;row&amp;gt;
        &amp;lt;table id="table2"&amp;gt;
            &amp;lt;title&amp;gt;Render Icons based on rangemap result&amp;lt;/title&amp;gt;
            &amp;lt;searchString&amp;gt;index=_internal | stats count by sourcetype,source,host&amp;lt;/searchString&amp;gt;
            &amp;lt;earliestTime&amp;gt;-1h&amp;lt;/earliestTime&amp;gt;
            &amp;lt;option name="drilldown"&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;Means, &lt;STRONG&gt;three tables == three js files&lt;/STRONG&gt;. And &lt;STRONG&gt;each js file&lt;/STRONG&gt; manage a &lt;STRONG&gt;single table&lt;/STRONG&gt;. Something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; 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;for the first table,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mvc.Components.get('table2').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;for the second one, and so on&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2015 12:58:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182464#M18034</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-03-26T12:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk 6.x Dashboard Examples: How to include multiple ID's for different tables (inline icon) in javascript?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182465#M18035</link>
      <description>&lt;P&gt;I verified this and it works after &lt;BR /&gt;
restart and clearing your browsercache:&lt;/P&gt;

&lt;P&gt;cat blabla/appserver/static/table_icons_inline2.js ::&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) {
        return cell.field === 'count';
    },
    render: function($td, cell) {
        var count = cell.value;

        // Compute the icon base on the field value
        var icon;
        if(count &amp;gt; 3000) {
            icon = 'alert-circle';
        } else if(count &amp;gt; 1000) {
            icon = 'alert';
        } else {
            icon = 'check';
        }

        // 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();
});


mvc.Components.get('table2').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;—————————&lt;/P&gt;

&lt;P&gt;cat blabla/default/data/ui/views/custom_table_icon_set_inline2.xml: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;label&amp;gt;Table Icon Set (Inline)&amp;lt;/label&amp;gt;

&amp;lt;row&amp;gt;
    &amp;lt;table id="table1"&amp;gt;
        &amp;lt;title&amp;gt;Render Icons based on rangemap result&amp;lt;/title&amp;gt;
        &amp;lt;searchString&amp;gt;index=_internal | stats count by sourcetype,source,host&amp;lt;/searchString&amp;gt;
        &amp;lt;earliestTime&amp;gt;-1h&amp;lt;/earliestTime&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
    &amp;lt;/table&amp;gt;
&amp;lt;/row&amp;gt;

&amp;lt;row&amp;gt;
    &amp;lt;table id="table2"&amp;gt;
        &amp;lt;title&amp;gt;Render second table Icons based on rangemap result&amp;lt;/title&amp;gt;
        &amp;lt;searchString&amp;gt;index=_internal | stats count by component&amp;lt;/searchString&amp;gt;
        &amp;lt;earliestTime&amp;gt;-1h&amp;lt;/earliestTime&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
    &amp;lt;/table&amp;gt;
&amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:20:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182465#M18035</guid>
      <dc:creator>baerts</dc:creator>
      <dc:date>2020-09-28T19:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk 6.x Dashboard Examples: How to include multiple ID's for different tables (inline icon) in javascript?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182466#M18036</link>
      <description>&lt;P&gt;This paste contains some errors &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2015 14:12:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182466#M18036</guid>
      <dc:creator>baerts</dc:creator>
      <dc:date>2015-03-26T14:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk 6.x Dashboard Examples: How to include multiple ID's for different tables (inline icon) in javascript?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182467#M18037</link>
      <description>&lt;P&gt;Thanks this worked!&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2015 13:35:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182467#M18037</guid>
      <dc:creator>jonathan_yan5</dc:creator>
      <dc:date>2015-03-31T13:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk 6.x Dashboard Examples: How to include multiple ID's for different tables (inline icon) in javascript?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182468#M18038</link>
      <description>&lt;P&gt;can you change by class instead of ID?,&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2016 23:12:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-6-x-Dashboard-Examples-How-to-include-multiple-ID-s-for/m-p/182468#M18038</guid>
      <dc:creator>martinstack</dc:creator>
      <dc:date>2016-08-10T23:12:58Z</dc:date>
    </item>
  </channel>
</rss>

