Splunk Search

JS Wait page fully loaded

timmalos
Communicator

Hi
I can't find any information on this subject so i ask you 🙂
I work on my application.js and i need to do some css work but only when all searches on my dashboard are finished. Some of them need more than 10 seconds to be fully loaded.

Tried the standard Jquery ready but dosn't work:

$(document).ready(function() {}

For now i use

setTimeout(function(){
    $('.panel_row2_col').before("<div id=monitoring></div>");
}, 20000);

But it's clearly only a workaround.

Thx for any help !

Tags (4)
1 Solution

sideview
SplunkTrust
SplunkTrust

There is an event called "PageReady" which is triggered by the PageStatus object.

I'm not sure to what extent the splunk UI uses this itself - possibly only the old pdfserver app uses it still, but I just tested on 5.0.4 and it does appear to still work.

Essentially PageStatus keeps track not just of the main HTML page load, but also all async processes like flash canvas loading, jobs still being dispatched, running jobs still running, flash canvas still rendering etc.. and it only gives the all clear in the form of that "PageReady" event, when everything has settled down and all jobs are completed.

$(document).bind("PageReady", someFunction);

I would throw an extra couple seconds of setTimeout in there for good measure though, because if it's no longer heavily used in the core product there might be some renders that are no longer being factored into the overall "ready" logic.

View solution in original post

0 Karma

sideview
SplunkTrust
SplunkTrust

There is an event called "PageReady" which is triggered by the PageStatus object.

I'm not sure to what extent the splunk UI uses this itself - possibly only the old pdfserver app uses it still, but I just tested on 5.0.4 and it does appear to still work.

Essentially PageStatus keeps track not just of the main HTML page load, but also all async processes like flash canvas loading, jobs still being dispatched, running jobs still running, flash canvas still rendering etc.. and it only gives the all clear in the form of that "PageReady" event, when everything has settled down and all jobs are completed.

$(document).bind("PageReady", someFunction);

I would throw an extra couple seconds of setTimeout in there for good measure though, because if it's no longer heavily used in the core product there might be some renders that are no longer being factored into the overall "ready" logic.

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

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