<?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: Display images instead of field values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Display-images-instead-of-field-values/m-p/194126#M187286</link>
    <description>&lt;P&gt;This will work for multiple columns :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if (Splunk.util.getCurrentView() == "**View_Name**") {
    if (Splunk.Module.SimpleResultsTable) {;
        Splunk.Module.SimpleResultsTable = $.klass(Splunk.Module.SimpleResultsTable, {
            forEachCellInColumn: function(columnName, callback) {
                var container = this.container;
                container.find("th:contains('" + columnName + "')").each(function() {
                    // does not support colspans.
                    var columnIndex = $(this).parent().children().index($(this));
                container.find("td:nth-child(" + (columnIndex+1)  + ")").each(function() {
                    callback($(this));
                });
            });
        },
    onResultsRendered: function() {
        this.forEachCellInColumn("**Column_Name_1**", function(tdElement) {
            if (tdElement.text()=="ok") {
                tdElement.text("").addClass("ok");
            } else if(tdElement.text()=="warning") {
                tdElement.text("").addClass("warning");
              else {
                tdElement.text("").addClass("critical");
            }
            }
        });

this.forEachCellInColumn("**Column_Name_2**", function(tdElement) {
                if (tdElement.text()=="ok") {
                    tdElement.text("").addClass("ok");
                } else if(tdElement.text()=="warning") {
                    tdElement.text("").addClass("warning");
                  else {
                    tdElement.text("").addClass("critical");
                }
                }
            });
    }
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;}&lt;/P&gt;</description>
    <pubDate>Tue, 25 Mar 2014 07:08:53 GMT</pubDate>
    <dc:creator>username021</dc:creator>
    <dc:date>2014-03-25T07:08:53Z</dc:date>
    <item>
      <title>Display images instead of field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-images-instead-of-field-values/m-p/194119#M187279</link>
      <description>&lt;P&gt;I have to replace some the table fields with strings like 'ok','warning','critical' with some images. &lt;BR /&gt;
I have added stanzas in application.css under appserver-&amp;gt; static folder&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SimpleResultstable. td.ok {.... }
SimpleResultstable. td.warning {.... }
SimpleResultstable. td.critacal {.... }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have placed the images in the same directory (OS-unix), but still the dashboard doesn't show the images instead only the strings are displayed.&lt;/P&gt;

&lt;P&gt;How can i troubleshoot this ?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 11:10:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-images-instead-of-field-values/m-p/194119#M187279</guid>
      <dc:creator>username021</dc:creator>
      <dc:date>2014-03-19T11:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: Display images instead of field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-images-instead-of-field-values/m-p/194120#M187280</link>
      <description>&lt;P&gt;What is the rest of your CSS? It does make a difference. For live help, use IRC #splunk on Efnet.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 11:27:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-images-instead-of-field-values/m-p/194120#M187280</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2014-03-19T11:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: Display images instead of field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-images-instead-of-field-values/m-p/194121#M187281</link>
      <description>&lt;P&gt;Set this up in you application.css file for the respective splunk app.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.SimpleResultsTable td.warning {
    background-image: url(images/warning.gif);
    background-repeat:no-repeat;
    background-position:5px 3px;
}

.SimpleResultsTable td.ok {
        background-image: url(images/ok.gif);
        background-repeat:no-repeat;
        background-position:5px 3px;
    }

.SimpleResultsTable td.critical {
        background-image: url(images/critical.gif);
        background-repeat:no-repeat;
        background-position:5px 3px;
    }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;this goes in the application.js file. Colmn Name and Values should match exactly to the value set in the dashboard. Restart the splunk instance after the change. Take care of the closing braces properly.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if (Splunk.util.getCurrentView() == "**View_Name**") {
    if (Splunk.Module.SimpleResultsTable) {;
        Splunk.Module.SimpleResultsTable = $.klass(Splunk.Module.SimpleResultsTable, {
            forEachCellInColumn: function(columnName, callback) {
                var container = this.container;
                container.find("th:contains('" + columnName + "')").each(function() {
                    // does not support colspans.
                    var columnIndex = $(this).parent().children().index($(this));

                    container.find("td:nth-child(" + (columnIndex+1)  + ")").each(function() {
                        callback($(this));
                    });
                });
            },
        onResultsRendered: function() {
            this.forEachCellInColumn("**Column_Name**", function(tdElement) {
                if (tdElement.text()=="ok") {
                    tdElement.text("").addClass("ok");
                } else if(tdElement.text()=="warning") {
                    tdElement.text("").addClass("warning");
                  else {
                    tdElement.text("").addClass("critical");
                }
                }
            });
        }
    });
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 11:52:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-images-instead-of-field-values/m-p/194121#M187281</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-03-19T11:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Display images instead of field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-images-instead-of-field-values/m-p/194122#M187282</link>
      <description>&lt;P&gt;Great, mark it as answer if so &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 20:57:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-images-instead-of-field-values/m-p/194122#M187282</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-03-19T20:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: Display images instead of field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-images-instead-of-field-values/m-p/194123#M187283</link>
      <description>&lt;P&gt;HI , I guess its possible to display images for 2 or more columns . I tried by copying the whole function again and passed "Column2_name" , but I couldnt get the images for column 2.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Mar 2014 07:04:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-images-instead-of-field-values/m-p/194123#M187283</guid>
      <dc:creator>username021</dc:creator>
      <dc:date>2014-03-24T07:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Display images instead of field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-images-instead-of-field-values/m-p/194124#M187284</link>
      <description>&lt;P&gt;Please mention the exact column name and the class values it will work. Don't make any duplicate which will not work.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Mar 2014 07:24:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-images-instead-of-field-values/m-p/194124#M187284</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-03-24T07:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: Display images instead of field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-images-instead-of-field-values/m-p/194125#M187285</link>
      <description>&lt;P&gt;yeah right. I have mentioned the exact column name. &lt;/P&gt;

&lt;P&gt;View name is same.&lt;BR /&gt;
class values are same.&lt;/P&gt;

&lt;P&gt;but , it works perfectly for only 1 column , and not the other.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Mar 2014 07:27:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-images-instead-of-field-values/m-p/194125#M187285</guid>
      <dc:creator>username021</dc:creator>
      <dc:date>2014-03-24T07:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: Display images instead of field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-images-instead-of-field-values/m-p/194126#M187286</link>
      <description>&lt;P&gt;This will work for multiple columns :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if (Splunk.util.getCurrentView() == "**View_Name**") {
    if (Splunk.Module.SimpleResultsTable) {;
        Splunk.Module.SimpleResultsTable = $.klass(Splunk.Module.SimpleResultsTable, {
            forEachCellInColumn: function(columnName, callback) {
                var container = this.container;
                container.find("th:contains('" + columnName + "')").each(function() {
                    // does not support colspans.
                    var columnIndex = $(this).parent().children().index($(this));
                container.find("td:nth-child(" + (columnIndex+1)  + ")").each(function() {
                    callback($(this));
                });
            });
        },
    onResultsRendered: function() {
        this.forEachCellInColumn("**Column_Name_1**", function(tdElement) {
            if (tdElement.text()=="ok") {
                tdElement.text("").addClass("ok");
            } else if(tdElement.text()=="warning") {
                tdElement.text("").addClass("warning");
              else {
                tdElement.text("").addClass("critical");
            }
            }
        });

this.forEachCellInColumn("**Column_Name_2**", function(tdElement) {
                if (tdElement.text()=="ok") {
                    tdElement.text("").addClass("ok");
                } else if(tdElement.text()=="warning") {
                    tdElement.text("").addClass("warning");
                  else {
                    tdElement.text("").addClass("critical");
                }
                }
            });
    }
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2014 07:08:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-images-instead-of-field-values/m-p/194126#M187286</guid>
      <dc:creator>username021</dc:creator>
      <dc:date>2014-03-25T07:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Display images instead of field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-images-instead-of-field-values/m-p/194127#M187287</link>
      <description>&lt;P&gt;Thanks linu. below Jscript will work for multiple columns.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2014 07:09:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-images-instead-of-field-values/m-p/194127#M187287</guid>
      <dc:creator>username021</dc:creator>
      <dc:date>2014-03-25T07:09:48Z</dc:date>
    </item>
  </channel>
</rss>

