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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...