<?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: .js and .css scripts not working for Splunk Dashboard in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411694#M27036</link>
    <description>&lt;P&gt;You mean&lt;BR /&gt;
&lt;A href="http://localhost:8000/en-GB/_bump"&gt;http://localhost:8000/en-GB/_bump&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;It gave Forbidden&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jun 2019 15:42:47 GMT</pubDate>
    <dc:creator>nagar57</dc:creator>
    <dc:date>2019-06-10T15:42:47Z</dc:date>
    <item>
      <title>.js and .css scripts not working for Splunk Dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411691#M27033</link>
      <description>&lt;P&gt;I have uploaded my .js and .css scripts in &lt;STRONG&gt;$SPLUNK_HOME/etc/apps/search/appserver/static&lt;/STRONG&gt; path, but still these scripts are now working.&lt;/P&gt;

&lt;P&gt;Below is my .js script:&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 active_hist_searches and the active_realtime_searches field
             return _(['ProductName']).contains(cell.field);
         },
         render: function($td, cell) {
             // Add a class to the cell based on the returned value
             var value = cell.value;
             // Apply interpretation for number of historical searches
             if (cell.field === 'ProductName') {
                 if (value === "Dream Crusher" ) {
                     $td.addClass('range-cell').addClass('range-green');
                 }
             }
             // Update the cell content
             $td.text(value).addClass('string');
         }
     });
     mvc.Components.get('highlight').getVisualization(function(tableView) {
         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);
             });
         },100);
         // Add custom cell renderer, the table will re-render automatically.
         tableView.addCellRenderer(new CustomRangeRenderer());
     });
 });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Below is my .css script&lt;/STRONG&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;gt; #highlight tr.range-orange td {
&amp;gt;      background-color:#ffcc99 !important;  }  #highlight
&amp;gt; tr.range-red td {
&amp;gt;      background-color:#ff0000 !important;  }  #highlight
&amp;gt; tr.range-green td {
&amp;gt;      background-color:#00ff00 !important;  }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have added these scripts in my Dashboard as:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;gt;  script="oip_table_row_color.js"
&amp;gt; stylesheet="oip_table_row_color.css"&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have already tried /debus/refresh and Clearing browser cookies. &lt;BR /&gt;
Also, restarted Splunk. But still The color coding is not reflecting in my dashboard. &lt;BR /&gt;
Do I need to add something in my Dashboard Xml?&lt;BR /&gt;
TIA&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 11:19:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411691#M27033</guid>
      <dc:creator>nagar57</dc:creator>
      <dc:date>2019-06-10T11:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: .js and .css scripts not working for Splunk Dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411692#M27034</link>
      <description>&lt;P&gt;@nagar57 &lt;/P&gt;

&lt;P&gt;have you tried &lt;CODE&gt;&lt;A href="https://SPLUNK_HOME:8000/en-GB/_bump" target="test_blank"&gt;https://SPLUNK_HOME:8000/en-GB/_bump&lt;/A&gt;&lt;/CODE&gt;  ?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 12:52:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411692#M27034</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-06-10T12:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: .js and .css scripts not working for Splunk Dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411693#M27035</link>
      <description>&lt;P&gt;Hi  nagar57,&lt;BR /&gt;
did you created your dashboard in Search App on in a different one?&lt;BR /&gt;
bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 12:58:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411693#M27035</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-06-10T12:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: .js and .css scripts not working for Splunk Dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411694#M27036</link>
      <description>&lt;P&gt;You mean&lt;BR /&gt;
&lt;A href="http://localhost:8000/en-GB/_bump"&gt;http://localhost:8000/en-GB/_bump&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;It gave Forbidden&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 15:42:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411694#M27036</guid>
      <dc:creator>nagar57</dc:creator>
      <dc:date>2019-06-10T15:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: .js and .css scripts not working for Splunk Dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411695#M27037</link>
      <description>&lt;P&gt;Yes the dashboard is in Search App&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 15:44:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411695#M27037</guid>
      <dc:creator>nagar57</dc:creator>
      <dc:date>2019-06-10T15:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: .js and .css scripts not working for Splunk Dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411696#M27038</link>
      <description>&lt;P&gt;@nagar57, while posting code on Splunk Answers make sure you use the Code button i.e. one with &lt;CODE&gt;101010&lt;/CODE&gt; or shortcut &lt;CODE&gt;Ctrl+K&lt;/CODE&gt;, so that special characters do not escape.  Based on the details provided, if you are trying to use the CSS and JS from Simple XML Dashboard examples app then it should have worked after refreshing Splunk and clearing Browser cache history. So try the following things for debugging:&lt;/P&gt;

&lt;P&gt;1) Type in the following URL if you have uploaded the static files under the &lt;CODE&gt;search&lt;/CODE&gt; app's &lt;CODE&gt;appserver/static&lt;/CODE&gt; folder.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&lt;A href="http://&amp;lt;yourSplunkServerAndPort&amp;gt;/en-US/static/app/search/oip_table_row_color.js" target="test_blank"&gt;http://&amp;lt;yourSplunkServerAndPort&amp;gt;/en-US/static/app/search/oip_table_row_color.js&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&lt;A href="http://&amp;lt;yourSplunkServerAndPort&amp;gt;/en-US/static/app/search/oip_table_row_color.css" target="test_blank"&gt;http://&amp;lt;yourSplunkServerAndPort&amp;gt;/en-US/static/app/search/oip_table_row_color.css&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;1) If you get Not Found error, then you have not uploaded the file to correct folder. You can also confirm this by right click and choosing Browser Inspector to see any Console error/s.&lt;BR /&gt;
2) If you can see the source code of JS and CSS then you have uploaded files to the correct folder but there is issue with the code.&lt;/P&gt;

&lt;P&gt;In order to look further at code related issues. Try the following:&lt;BR /&gt;
2 a) For CSS move the code from CSS file to html panel in dashboard i.e. under the following code&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;row depends="$alwaysHideCSSPanel$"&amp;gt;
    &amp;lt;panel&amp;gt;
        &amp;lt;html&amp;gt;
            &amp;lt;style&amp;gt;
                &amp;lt;!-- Your CSS Style override goes here--&amp;gt;
            &amp;lt;/style&amp;gt;
        &amp;lt;/html
    &amp;lt;/panel&amp;gt;
&amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2 b) Once CSS is found to be written correctly, change the JS Code to print only debug info first i.e.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
    'underscore',
    'jquery',
    'splunkjs/mvc',
    'splunkjs/mvc/tableview',
    'splunkjs/mvc/simplexml/ready!'
], function(_, $, mvc, TableView) {
       console.log("Inside JS Script for Table Render Extension");
});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Jun 2019 16:46:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411696#M27038</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-06-10T16:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: .js and .css scripts not working for Splunk Dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411697#M27039</link>
      <description>&lt;P&gt;First of all Thanks a lot for taking so much pain to explain in this detail &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
I am able to read my .jss and .css files through &lt;A href="http://localhost:8000/static/app/search/oip_table_row_color.js"&gt;http://localhost:8000/static/app/search/oip_table_row_color.js&lt;/A&gt;&lt;BR /&gt;
Now as you mentioned I changed the .js script to just print only debug info. I am pretty knew to Splunk so could you please help me out on how can I see this debug log info through splunk&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 17:09:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411697#M27039</guid>
      <dc:creator>nagar57</dc:creator>
      <dc:date>2019-06-10T17:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: .js and .css scripts not working for Splunk Dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411698#M27040</link>
      <description>&lt;P&gt;Right Click on browser and select the Inspect Option. You should have several tabs of which one would be Console.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/590387/how-do-i-update-panel-color-in-splunk-using-css-1.html"&gt;https://answers.splunk.com/answers/590387/how-do-i-update-panel-color-in-splunk-using-css-1.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 17:18:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411698#M27040</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-06-10T17:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: .js and .css scripts not working for Splunk Dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411699#M27041</link>
      <description>&lt;P&gt;Yes, I can see the debug log.&lt;BR /&gt;
Also, I tried with bump and what I can see is when I am refreshing the dashboard color appears and then goes away. I don't know what is going wrong.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 17:37:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411699#M27041</guid>
      <dc:creator>nagar57</dc:creator>
      <dc:date>2019-06-10T17:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: .js and .css scripts not working for Splunk Dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411700#M27042</link>
      <description>&lt;P&gt;Possible reason,&lt;BR /&gt;
1. Check the permission and user role of the two file added&lt;BR /&gt;
2. Check whether it is in the same application. if not prefix app_name: in your dashboard&lt;BR /&gt;
    e.g: script="search:my_code.js" stylesheet="my_code.css"&lt;/P&gt;

&lt;P&gt;I guess yours is reason 1&lt;/P&gt;

&lt;P&gt;After changing permission restart SH&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:52:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411700#M27042</guid>
      <dc:creator>paramagurukarth</dc:creator>
      <dc:date>2020-09-30T00:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: .js and .css scripts not working for Splunk Dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411701#M27043</link>
      <description>&lt;P&gt;You might have created your dashboard in search app and might have put js and css in appserver/static folder of some other app. This has happened with me once.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Pallavi&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 10:37:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411701#M27043</guid>
      <dc:creator>pallavi25</dc:creator>
      <dc:date>2019-09-25T10:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: .js and .css scripts not working for Splunk Dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411702#M27044</link>
      <description>&lt;P&gt;@pallavi25  Well this was not the issue. The issue was with the file permissions.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 11:51:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411702#M27044</guid>
      <dc:creator>nagar57</dc:creator>
      <dc:date>2019-09-25T11:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: .js and .css scripts not working for Splunk Dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411703#M27045</link>
      <description>&lt;P&gt;Seems like you are running into known issue with 6.6+ where TableView needs slight delay in rendering. So setTimeout needs to be added. Refer to one of previous answers: &lt;A href="https://answers.splunk.com/answers/614788/splunk-dashboard-examples-table-row-highlighting-b.html"&gt;https://answers.splunk.com/answers/614788/splunk-dashboard-examples-table-row-highlighting-b.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Apr 2020 18:15:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/js-and-css-scripts-not-working-for-Splunk-Dashboard/m-p/411703#M27045</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-04-12T18:15:11Z</dc:date>
    </item>
  </channel>
</rss>

