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!

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...