Skip to content

Instantly share code, notes, and snippets.

@hobbes3
Last active August 29, 2015 14:05
Show Gist options
  • Save hobbes3/db65e8794c7f783b0a1b to your computer and use it in GitHub Desktop.
Save hobbes3/db65e8794c7f783b0a1b to your computer and use it in GitHub Desktop.
total results count table
require([
'jquery',
'underscore',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
],
function(
$,
_,
mvc
) {
// Initially set the $ip_count$ token
// You don't need an input placeholder in Simple XML (like pre-6.1 in-page drilldown example)
mvc.Components.get('default').set('ip_count', "Waiting...");
// Grab the search object from the first panel
// There may be a better way to get the first panel's search
var ip_search = mvc.Components.getInstance("search1");
// When the search finishes...
ip_search.on('search:done', function(properties) {
// Get the total results
var ip_count = this.attributes.data.resultCount;
// Update the token
// There is no need to actually submit and update the URL since this token can always be re-calculated on every page load
mvc.Components.get('default').set('ip_count', ip_count);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment