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!

Exciting News: The AppDynamics Community Joins Splunk!

Hello Splunkers,   I’d like to introduce myself—I’m Ryan, the former AppDynamics Community Manager, and I’m ...

The All New Performance Insights for Splunk

Splunk gives you amazing tools to analyze system data and make business-critical decisions, react to issues, ...

Good Sourcetype Naming

When it comes to getting data in, one of the earliest decisions made is what to use as a sourcetype. Often, ...