Splunk Dev

js' $(document).ready function not firing when TableView has no "No results found."

rickferrante
Explorer

I have a token that i'm setting in javascript's $(document).ready function.   The token is set when the dashboards main TableView loads up with data.  But when the TableView returns no data, I'm seeing "No results found."  in the field associated with the token (js code snippet below).

I was expecting that $(document).ready would fire regardless of whether a TableView's search returned data or not.  

Any help would be appreciated.

Rick

require([
"underscore",
"jquery",
"splunkjs/mvc",
"splunkjs/mvc/searchmanager",
"splunkjs/mvc/searchbarview",
"splunkjs/mvc/searchcontrolsview",
"splunkjs/mvc/tableview",
"splunkjs/mvc/simplexml/element/table",
"splunkjs/mvc/textinputview",
"splunkjs/mvc/dropdownview",
"splunkjs/mvc/timerangeview",
"splunkjs/mvc/eventsviewerview",
"splunkjs/mvc/simplexml/ready!"
], function(
_,
$,
mvc,
SearchManager,
SearchbarView,
SearchControlsView,
TableView,
TableElement,
TextInputView,
DropdownView,
TimeRangeView,
EventsViewer
) {

var tokens = mvc.Components.get("default");
var selected_values_array = [];
var submittedTokens = mvc.Components.get('submitted');

$(document).ready(function () {
var service = mvc.createService();
service.currentUser(function(err, user) {
real_name = user.properties().realname
usr = user.name
email = user.properties().email
roles = user.properties().roles
if (real_name == "") {
real_name = "FNU"; // #full name unavailable(not in splunk)
}
if (email == "") {
email = "EMU"; // #email unavailable (not in splunk)
}

current = real_name + " (" + email +")"
tokens.set("userName",current)
});

 

 

Labels (2)
Tags (1)
0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...