<?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: Javascript for dashboard not working in Splunk 7 in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344535#M22426</link>
    <description>&lt;P&gt;You need to make sure the JS is &lt;CODE&gt;ready&lt;/CODE&gt; for calls. Add this to your requirejs stack:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;splunkjs/ready!&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;This will make sure the splunkJS is ready and the registry is loaded.&lt;/P&gt;</description>
    <pubDate>Mon, 06 Nov 2017 14:43:13 GMT</pubDate>
    <dc:creator>alacercogitatus</dc:creator>
    <dc:date>2017-11-06T14:43:13Z</dc:date>
    <item>
      <title>Javascript for dashboard not working in Splunk 7</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344534#M22425</link>
      <description>&lt;P&gt;We have an HTML dashboard that displays some data in a table with custom colour coding and drilldowns applied using jQuery selectors in Javascript. Since upgrading to Splunk 6.6 there have been problems with the colour coding etc. not being applied upon loading. Now after upgrading to 7.0 on our search head the table doesn't display at all; I get "Uncaught Error: VisualisationRegistry has not been populated" in the console in Chrome. I've also tried other browsers and get the same problem.&lt;/P&gt;

&lt;P&gt;I believe this is a problem with the TableView visualisation in Splunk 7. I've tried substituting TableView for TableElement (the default name after converting a table in a simple XML dashboard to HTML) in the Javascript itself and the table is now rendered, but there is no colour coding or any sign of the jQuery functions we have being applied at all.&lt;/P&gt;

&lt;P&gt;Anyone had similar problems with Javascript dashboards after recent upgrades? Has the support for these visualisations changed or have the dependencies been affected in Splunk 7 or 6.6?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 14:27:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344534#M22425</guid>
      <dc:creator>jhigginsmq</dc:creator>
      <dc:date>2017-11-06T14:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript for dashboard not working in Splunk 7</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344535#M22426</link>
      <description>&lt;P&gt;You need to make sure the JS is &lt;CODE&gt;ready&lt;/CODE&gt; for calls. Add this to your requirejs stack:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;splunkjs/ready!&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;This will make sure the splunkJS is ready and the registry is loaded.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 14:43:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344535#M22426</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2017-11-06T14:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript for dashboard not working in Splunk 7</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344536#M22427</link>
      <description>&lt;P&gt;Thanks for that, adding it fixes the issue with the table not displaying but I'm getting the same issue with the jQuery not being applied.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 15:30:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344536#M22427</guid>
      <dc:creator>jhigginsmq</dc:creator>
      <dc:date>2017-11-06T15:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript for dashboard not working in Splunk 7</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344537#M22428</link>
      <description>&lt;P&gt;HI @jhigginsmq,&lt;/P&gt;

&lt;P&gt;My javascript code is working properly in 6.x &amp;amp; 7.0 both.&lt;/P&gt;

&lt;P&gt;Below is my sample code. Can you please try it or compare it with your code?&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 CustomRangeRenderer = TableView.BaseCellRenderer.extend({
        canRender: function(cell) {
            return _(['My Column Namwe']).contains(cell.field);
        },
        render: function($td, cell) {
            if(cell.value=="red" || cell.value=="green" || cell.value=="yellow")
            {
                $td.html("&amp;lt;div class='circle_"+cell.value+"'&amp;gt;&amp;lt;/div&amp;gt;")
            }
            else if(cell.value=="NoData" || cell.value=="null")
            {
                $td.html("&amp;lt;div class='align_center'&amp;gt;&amp;lt;/div&amp;gt;")
            }
            else
            {
                $td.html("&amp;lt;div class='align_center'&amp;gt;"+cell.value+"&amp;lt;/div&amp;gt;")
            }
        }
    });

    //List of table IDs to add icon
    var tableIDs = ["Mytable"];
    for (i=0;i&amp;lt;tableIDs.length;i++) {
        var sh = mvc.Components.get(tableIDs[i]);
        if(typeof(sh)!="undefined") {
            sh.getVisualization(function(tableView) {
                // Add custom cell renderer and force re-render
                tableView.table.addCellRenderer(new CustomRangeRenderer());
                tableView.table.render();
            });
        }
    }    
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Happy Splunking&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 16:03:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344537#M22428</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-11-06T16:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript for dashboard not working in Splunk 7</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344538#M22429</link>
      <description>&lt;P&gt;@jhigginsmq, I believe you are using jQuery for Table Row Highlighting based on Table Cell value. I have noticed that post 6.5 this require us to add some delay even after rendering the table otherwise default color overrides the color we want to apply...&lt;/P&gt;

&lt;P&gt;Following is an example for adding some delay before applying row color:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     tableView.on('rendered', function() {
         // Add a delay to ensure Custom Render applies to row without getting overridden with built in reder.            
         setTimeout(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);
     });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Refer to one of my answers on similar lines:&lt;A href="https://answers.splunk.com/answers/588394/change-the-color-of-rows-in-a-table-based-on-text-1.html"&gt;https://answers.splunk.com/answers/588394/change-the-color-of-rows-in-a-table-based-on-text-1.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Please try out and confirm. If it does not work you might need to paste what you currently have. Just ensure that every time you modify JSS you refresh/bump your Splunk instance for latest static files to reflect changes. May also need to clear internet browser history.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 16:05:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344538#M22429</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-06T16:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript for dashboard not working in Splunk 7</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344539#M22430</link>
      <description>&lt;P&gt;Adding the delay has fixed it! Thanks we've been going for months with an ugly, colour-less database table.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 17:01:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344539#M22430</guid>
      <dc:creator>jhigginsmq</dc:creator>
      <dc:date>2017-11-06T17:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript for dashboard not working in Splunk 7</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344540#M22431</link>
      <description>&lt;P&gt;Thanks, ours looks quite different but good to see another example.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 17:02:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344540#M22431</guid>
      <dc:creator>jhigginsmq</dc:creator>
      <dc:date>2017-11-06T17:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript for dashboard not working in Splunk 7</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344541#M22432</link>
      <description>&lt;P&gt;i have the same problem and i don't find any solution.&lt;BR /&gt;
nothing work (xml or html) dashboard.&lt;BR /&gt;
splunk wont execute  tableView.on('rendered', function() { &lt;BR /&gt;
i tryed with the delay but nothing happen  &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;what's happen with splunk 7 ? why is being complicated for splunkjs stack right there&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 13:36:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344541#M22432</guid>
      <dc:creator>sfatnass</dc:creator>
      <dc:date>2018-09-12T13:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript for dashboard not working in Splunk 7</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344542#M22433</link>
      <description>&lt;P&gt;@sfatnass the behavior has been same since Splunk 6.6 where &lt;CODE&gt;setTimeout()&lt;/CODE&gt; is required inside TableView &lt;CODE&gt;render()&lt;/CODE&gt; function. So the workaround should still hold true. Have you tried debug refresh or bump of environment to ensure that latest JavaScript code is getting pulled? Also can you add some Console Logs outputs to ensure whether code flow is hitting all the code blocks or not?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 14:02:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344542#M22433</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-09-13T14:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript for dashboard not working in Splunk 7</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344543#M22434</link>
      <description>&lt;P&gt;@niketnilay yes of course i bump and debug/refresh ^^&lt;BR /&gt;
when i add setTimeout() nothing change.&lt;BR /&gt;
and yes i use console.log to show where i am and i found that any render() function not loaded.&lt;BR /&gt;
but sometime it work but make a lot a lot of time :(.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 14:55:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344543#M22434</guid>
      <dc:creator>sfatnass</dc:creator>
      <dc:date>2018-09-13T14:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript for dashboard not working in Splunk 7</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344544#M22435</link>
      <description>&lt;P&gt;@sfatnass, are you trying Table Row Highlighting? How Many Columns Do you have? Is there Maximum displayed Column (if the number of columns is not fixed)? Are the column Names fixed/static or may change i.e. like Date or something similar?&lt;/P&gt;

&lt;P&gt;Finally, have you posted any recent question with the details of what you have and what you want with mock screenshots? Since the post is roughly a year old would you be able to create a new question so that it gets proper attention?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 15:15:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344544#M22435</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-09-13T15:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript for dashboard not working in Splunk 7</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344545#M22436</link>
      <description>&lt;P&gt;@niketnilay, i submit an app exemple (xml and html dashboards)&lt;BR /&gt;
my objectif is simple, if i click on cell "id" i need to highlight the value.&lt;/P&gt;

&lt;P&gt;you  are able to download/edit  the app &lt;A href="https://splunkbase.splunk.com/app/4184/"&gt;https://splunkbase.splunk.com/app/4184/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;if you have any solution for me i'm interested&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 13:45:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Javascript-for-dashboard-not-working-in-Splunk-7/m-p/344545#M22436</guid>
      <dc:creator>sfatnass</dc:creator>
      <dc:date>2018-09-14T13:45:58Z</dc:date>
    </item>
  </channel>
</rss>

