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!

Announcing Scheduled Export GA for Dashboard Studio

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

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...