@BearMormont, Although Splunk provides Paginator with tableView , it does not give SplunkJS event handler for configuring click on Paginator: http://docs.splunk.com/DocumentationStatic/WebFramework/1.0/compref_table.html. However, in your case you want to unset the drilldown token whenever someone moves out of a particular page with drilldown. Which in turn implies the token can be unset whenever the table is rendered again after setting the token.
SplunkJS provides tableView.on("rendered",function(){} to capture event when the table is rendered. You can use SplunkJS stack to unset the token for submitted and default token models using the same. PS: This also means that when you change any other input/token including dashboard refresh then the drilldown token will be unset. However, that would be an expected behavior as per your use case:
Following is the run anywhere Simple XML Dashboard Code:
<form script="table_render_token_reset.js">
<label>Token Reset on Table Navigation</label>
<fieldset submitButton="false"></fieldset>
<row>
<panel>
<title>Splunkd Top Components with Errors</title>
<input type="time" token="tokTime" searchWhenChanged="true">
<label>Select Time</label>
<default>
<earliest>-24h@h</earliest>
<latest>now</latest>
</default>
</input>
<table id="table1">
<search>
<query>index=_internal sourcetype=splunkd log_level!=INFO
| top 20 component showperc=f countfield="Errors"</query>
<earliest>$tokTime.earliest$</earliest>
<latest>$tokTime.latest$</latest>
<sampleRatio>1</sampleRatio>
</search>
<option name="count">5</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">cell</option>
<option name="percentagesRow">false</option>
<option name="refresh.display">progressbar</option>
<option name="rowNumbers">true</option>
<option name="totalsRow">false</option>
<option name="wrap">true</option>
<drilldown>
<set token="tokComponent">$click.value$</set>
</drilldown>
</table>
</panel>
</row>
<row depends="$tokComponent$">
<panel>
<title>Error for Splunk component $tokComponent$ over selected time</title>
<chart>
<search>
<query>index=_internal sourcetype=splunkd log_level!=INFO component="$tokComponent$"
| timechart count as "Errors"</query>
<earliest>$tokTime.earliest$</earliest>
<latest>$tokTime.latest$</latest>
</search>
<option name="charting.axisTitleX.text">Time</option>
<option name="refresh.display">progressbar</option>
</chart>
</panel>
</row>
</form>
Following is the code for table_render_token_reset.js JavaScript file to be included in the Simple XML Dashboard. This should ideally be placed under $SPLUNK_HOME/etc/apps/<YourAppName>/appserver/static . You might have to created appserver/static folder if the same does not exist already.
PS: Since this change requires Static file change you might have to refresh/restart/bump your Splunk instance and may also require to clear your internet browser history for the changes to take effect.
require([
"jquery",
"splunkjs/mvc",
"splunkjs/mvc/simplexml/ready!"
], function($,mvc) {
mvc.Components.get('table1').getVisualization(function(tableView) {
tableView.on('rendered', function() {
var defaultTokenModel=mvc.Components.get("default");
var submittedTokenModel=mvc.Components.get("submitted");
defaultTokenModel.unset("tokComponent");
submittedTokenModel.unset("tokComponent");
});
});
});
Please try out and confirm.
... View more