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!

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2025 SplunkTrust is officially open! If you ...

Splunk Answers Content Calendar, June Edition II

Get ready to dive into Splunk Dashboard panels this week! We'll be tackling common questions around ...

Splunk Observability Cloud's AI Assistant in Action Series: Auditing Compliance and ...

This is the third post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...