How do I load a report from the server on window.onload?


Once the HTML page has finished loading I need to load a server report. I have tried performing the load after the embedPivotComponent method and this does not work.
 flexmonster.embedPivotComponent(“/flexmonster/”, “pivotContainer”, “100%”, “615”, config, true);
I have also tried trapping window.onload = and even went through a conditioning sequence to insure the flexgrids onload calls occur first
var oldOnLoad = window.onload;
    // if there is not any function hooked to it
    if (typeof window.onload != 'function') {
        // you can hook your function with it
        window.onload = func
    } else { // someone already hooked a function
        window.onload = function () {
            // call the function hooked already
            // call your awesome function
There appears to be no configuration property to enable this. My reason for the post onload call is that I’m building an application that allows the user to embed the report name in the URL. For example: myserver/report.html?reportid=myreport
I have server-side code that splits out the myreport value from the URI and makes it available to the JavaScript. The problem is invoking the flexmonster.load(‘url’); once the page is done loading. Is this really an uncommon workflow?

1 answer

Roman Petrusha Staff March 24, 2016


Yes, I understand your problem. You can’t use window.onload event because the component requires more time for initialization. It’s still loading libs and resources after onload event fired. I recommend you to use jsPivotCreationCompleteHandler in this case. E.g.
var pivot = flexmonster.embedPivotComponent(“”, “pivotContainer”, “100%”, “600”,
  jsPivotCreationCompleteHandler: onCreationComplete
}, true);
function onCreationComplete() {
Does it work for you?

Please login or Register to Submit Answer