<?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: how to load drilldown from external javascript file? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342847#M22280</link>
    <description>&lt;P&gt;try changing the line at the top of the file to this&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;function (_, $, mvc, utils, TokenUtils, UrlTokenModel)&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Apr 2017 14:55:47 GMT</pubDate>
    <dc:creator>rjthibod</dc:creator>
    <dc:date>2017-04-21T14:55:47Z</dc:date>
    <item>
      <title>how to load drilldown from external javascript file?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342839#M22272</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;i want to load a drilldown from an external file javascript instead of including it on the dashboard.&lt;/P&gt;

&lt;P&gt;i tryied to use something like that in my javascript&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
        'underscore',
        'jquery',
        'splunkjs/mvc',
        'splunkjs/mvc/utils',
        'splunkjs/mvc/tokenutils',
        'splunkjs/mvc/simplexml/urltokenmodel',
        'splunkjs/mvc/simplexml/ready!'
    ], function (_, $, utils, TokenUtils, mvc, UrlTokenModel) {

    $('#mytable').on('click', function (event) {
        event.preventDefault();
        var value1 = event.data['row.fieldname'];

        var url = TokenUtils.replaceTokenNames("{{SPLUNKWEB_URL_PREFIX}}/app/myapp/dbDestination?tokenValue=" + value1, _.extend(submittedTokenModel.toJSON(), event.data), TokenUtils.getEscaper('url'));
        utils.redirect(url, false, "_blank");

    });
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but how the js can resolve the row.data and how can run the drilldown function&lt;BR /&gt;
nothing work only the click event.&lt;/P&gt;

&lt;P&gt;can someone help me?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 13:27:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342839#M22272</guid>
      <dc:creator>sfatnass</dc:creator>
      <dc:date>2017-04-21T13:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to load drilldown from external javascript file?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342840#M22273</link>
      <description>&lt;P&gt;You are incorrectly trying to apply the chart selector in order to assign the drilldown.&lt;/P&gt;

&lt;P&gt;The code pattern in JS using the SplunkJS framework should look like this instead of using the jquery selector &lt;CODE&gt;$("#mytable)&lt;/CODE&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mvc.Components.getInstance("mytable").on("click", function(event) {
  event.preventDefault();
  var value1 = event.data['row.fieldname'];

  var url = TokenUtils.replaceTokenNames("{{SPLUNKWEB_URL_PREFIX}}/app/myapp/dbDestination?tokenValue=" + value1, _.extend(submittedTokenModel.toJSON(), event.data), TokenUtils.getEscaper('url'));
  utils.redirect(url, false, "_blank");
});        
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Apr 2017 13:38:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342840#M22273</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-04-21T13:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to load drilldown from external javascript file?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342841#M22274</link>
      <description>&lt;P&gt;Oh yes i forget it.&lt;BR /&gt;
this only work to retreive the row values but can't load the drilldown yet &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;splunkjs.mvc.Components.getInstance("mytable").on("click", function(event) {
   event.preventDefault();
   var value1 = event.data['row.fieldname'];

   var url = TokenUtils.replaceTokenNames("{{SPLUNKWEB_URL_PREFIX}}/app/myapp/dbDestination?tokenValue=" + value1, _.extend(submittedTokenModel.toJSON(), event.data), TokenUtils.getEscaper('url'));
   utils.redirect(url, false, "_blank");
 }); 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Apr 2017 14:01:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342841#M22274</guid>
      <dc:creator>sfatnass</dc:creator>
      <dc:date>2017-04-21T14:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to load drilldown from external javascript file?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342842#M22275</link>
      <description>&lt;P&gt;I am sorry but I am unclear on what your problem is. Can you clarify what is not working?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 14:06:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342842#M22275</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-04-21T14:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to load drilldown from external javascript file?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342843#M22276</link>
      <description>&lt;P&gt;this not work&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  var url = TokenUtils.replaceTokenNames("{{SPLUNKWEB_URL_PREFIX}}/app/myapp/dbDestination?tokenValue=" + value1, _.extend(submittedTokenModel.toJSON(), event.data), TokenUtils.getEscaper('url'));
    utils.redirect(url, false, "_blank");
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Apr 2017 14:08:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342843#M22276</guid>
      <dc:creator>sfatnass</dc:creator>
      <dc:date>2017-04-21T14:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to load drilldown from external javascript file?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342844#M22277</link>
      <description>&lt;P&gt;i have this error when i click on table&lt;BR /&gt;
submittedTokenModel is not defined&lt;BR /&gt;
 and what about {{SPLUNKWEB_URL_PREFIX}} how to resolve it within javascript?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:46:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342844#M22277</guid>
      <dc:creator>sfatnass</dc:creator>
      <dc:date>2020-09-29T13:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to load drilldown from external javascript file?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342845#M22278</link>
      <description>&lt;P&gt;Add these lines to your JS.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var submittedTokenModel = mvc.Components.get('submitted');
var defaultTokenModel   = mvc.Components.get('default');
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Apr 2017 14:36:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342845#M22278</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-04-21T14:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: how to load drilldown from external javascript file?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342846#M22279</link>
      <description>&lt;P&gt;i added  this and i get this error now&lt;BR /&gt;
TokenUtils.getEscaper is not a function&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 14:44:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342846#M22279</guid>
      <dc:creator>sfatnass</dc:creator>
      <dc:date>2017-04-21T14:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to load drilldown from external javascript file?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342847#M22280</link>
      <description>&lt;P&gt;try changing the line at the top of the file to this&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;function (_, $, mvc, utils, TokenUtils, UrlTokenModel)&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 14:55:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342847#M22280</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-04-21T14:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: how to load drilldown from external javascript file?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342848#M22281</link>
      <description>&lt;P&gt;yes it work &lt;BR /&gt;
now he stays to resolve {{SPLUNKWEB_URL_PREFIX}}&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:46:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342848#M22281</guid>
      <dc:creator>sfatnass</dc:creator>
      <dc:date>2020-09-29T13:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to load drilldown from external javascript file?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342849#M22282</link>
      <description>&lt;P&gt;well no need to resolve&lt;BR /&gt;
i just replace by&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var url = TokenUtils.replaceTokenNames("dbDestination?tokenValue=" + value1, _.extend(submittedTokenModel.toJSON(), event.data), TokenUtils.getEscaper('url'));
     utils.redirect(url, false, "_blank");
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;thx for your help rjthibod &lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 15:41:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-load-drilldown-from-external-javascript-file/m-p/342849#M22282</guid>
      <dc:creator>sfatnass</dc:creator>
      <dc:date>2017-04-21T15:41:35Z</dc:date>
    </item>
  </channel>
</rss>

