Get Free Trial

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

Jeremy Deats asked on March 24, 2016

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?

2 answers

Roman Petrusha Roman Petrusha Flexmonster 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?

Tanya Gryshko Tanya Gryshko Flexmonster December 5, 2016

Hello Jeremy and all Flexmonster users,
In version 2.3 jsPivotCreationCompleteHandler was replaced with reportcomplete event. In the previous version embedPivotComponent() function was used to embed the component. In the version 2.3 it was removed, but it will be supported in this version in terms of backward compatibility. Instead of embedPivotComponent() you should use a jQuery call. Please read our guide for migration from the previous major version to 2.3.

Please login or Register to Submit Answer