<?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: jQuery issue in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/jQuery-issue/m-p/190807#M11888</link>
    <description>&lt;P&gt;You need to provide some context to your question. Where are you putting your javascript? What type of dashboard are you using? &lt;/P&gt;</description>
    <pubDate>Fri, 03 Jul 2015 16:15:22 GMT</pubDate>
    <dc:creator>alacercogitatus</dc:creator>
    <dc:date>2015-07-03T16:15:22Z</dc:date>
    <item>
      <title>jQuery issue</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/jQuery-issue/m-p/190806#M11887</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;

&lt;P&gt;I'm trying to change the background of some panels with jQuery+CSS when they have one value or another, but nothing happens. It's like the script is never executed. I put some &lt;STRONG&gt;alert()&lt;/STRONG&gt; and the inside ones from &lt;STRONG&gt;$(document).ready&lt;/STRONG&gt; never show up. &lt;/P&gt;

&lt;P&gt;What am I missing?&lt;/P&gt;

&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jul 2015 10:53:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/jQuery-issue/m-p/190806#M11887</guid>
      <dc:creator>slr</dc:creator>
      <dc:date>2015-07-03T10:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: jQuery issue</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/jQuery-issue/m-p/190807#M11888</link>
      <description>&lt;P&gt;You need to provide some context to your question. Where are you putting your javascript? What type of dashboard are you using? &lt;/P&gt;</description>
      <pubDate>Fri, 03 Jul 2015 16:15:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/jQuery-issue/m-p/190807#M11888</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2015-07-03T16:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: jQuery issue</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/jQuery-issue/m-p/190808#M11889</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;What type of dashboard are you using?&lt;BR /&gt;
I'm using a single value dashboard. I'm trying to change the background color with jquery+css when the **** has some value. &lt;/P&gt;

&lt;P&gt;Where are you putting your javascript?&lt;BR /&gt;
I tried with a JS file: &lt;BR /&gt;
I tried with the embebed option, loading the original api from jquery: &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard&amp;gt;
&amp;lt;html&amp;gt;
    &amp;lt;script src="jquery/jquery-2.1.4.min.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="file.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script&amp;gt;jQuery.noConflict();&amp;lt;/script&amp;gt;
  &amp;lt;/html&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thank you in advance, but ... what am I missing?&lt;/P&gt;

&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2015 08:15:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/jQuery-issue/m-p/190808#M11889</guid>
      <dc:creator>slr</dc:creator>
      <dc:date>2015-07-06T08:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: jQuery issue</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/jQuery-issue/m-p/190809#M11890</link>
      <description>&lt;P&gt;Single value is not a dashboard type. HTML or Simple XML are dashboard types. Single Value is a module (or panel) on a dashboard. I need to know first the dashboard type, and some example code you have in place. &lt;/P&gt;

&lt;P&gt;You can use the &lt;CODE&gt;range&lt;/CODE&gt; command to help build out what you are looking for.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your_search&amp;gt;| range &amp;lt;myfield&amp;gt; 0-100=low 101-200=medium default=high
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then in  your Single Value XML, place this option:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;option name="classField"&amp;gt;range&amp;lt;/option&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will assign the results of the &lt;CODE&gt;range&lt;/CODE&gt; command to your panel, and as long as &lt;CODE&gt;low&lt;/CODE&gt;, &lt;CODE&gt;medium&lt;/CODE&gt;, and &lt;CODE&gt;high&lt;/CODE&gt; are CSS classes in your &lt;CODE&gt;dashboard.css&lt;/CODE&gt; file, you should be able to see the color change.&lt;/P&gt;

&lt;P&gt;===Update===&lt;/P&gt;

&lt;P&gt;Ok, so based on that, add this code into &lt;CODE&gt;change.js&lt;/CODE&gt;. Once added, Refresh the debug endpoint (&lt;A href="https://yoursplunk/en-US/debug/refresh"&gt;https://yoursplunk/en-US/debug/refresh&lt;/A&gt;) and then click the button at &lt;A href="https://yoursplunk/en-US/_bump"&gt;https://yoursplunk/en-US/_bump&lt;/A&gt;. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require(['jquery'], function($){
    alert("ChangeMe");
});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Jul 2015 11:53:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/jQuery-issue/m-p/190809#M11890</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2015-07-06T11:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: jQuery issue</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/jQuery-issue/m-p/190810#M11891</link>
      <description>&lt;P&gt;Sorry about my misunderstanding. &lt;/P&gt;

&lt;P&gt;I tried both (HTML and XML) with the same result. I am using the range command, but I want to change the panel's background dynamically when the value reach some limits by adding classes  in **** . Actually, this is my XML dashboard:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard stylesheet="style.css" script="change.js"&amp;gt;
&amp;lt;row&amp;gt;
            &amp;lt;single&amp;gt;
                &amp;lt;searchString&amp;gt;index=some_index filter="value" | stats count by filter | fields - filter | rangemap field=count none=0-1000 low=1001-2000 guarded=2001-3000 elevated=3001-5000 high=5001-8000 severe=8001-20000 default=none&amp;lt;/searchString&amp;gt;
                &amp;lt;earliestTime&amp;gt;-2y&amp;lt;/earliestTime&amp;gt;
                &amp;lt;latestTime&amp;gt;now&amp;lt;/latestTime&amp;gt;
                &amp;lt;option name="classField"&amp;gt;range&amp;lt;/option&amp;gt;
                &amp;lt;option name="field"&amp;gt;value&amp;lt;/option&amp;gt;
            &amp;lt;/single&amp;gt;
    &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And the script &lt;STRONG&gt;change.js&lt;/STRONG&gt; has alerts like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$(document).ready(function () {
        alert("Show me");
        });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...but they never show up, and that means that the &lt;STRONG&gt;$(document).ready&lt;/STRONG&gt; doesn't run. I tried with &lt;STRONG&gt;$(document).ajaxSuccess&lt;/STRONG&gt; and &lt;STRONG&gt;$(document).ajaxComplete&lt;/STRONG&gt;, but nothing different happens.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2015 12:23:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/jQuery-issue/m-p/190810#M11891</guid>
      <dc:creator>slr</dc:creator>
      <dc:date>2015-07-06T12:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: jQuery issue</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/jQuery-issue/m-p/190811#M11892</link>
      <description>&lt;P&gt;You can also find me on IRC (#splunk on efnet.org) for a step-by-step troubleshooting.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2015 22:13:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/jQuery-issue/m-p/190811#M11892</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2015-07-06T22:13:49Z</dc:date>
    </item>
  </channel>
</rss>

