Is there a Client Side Event that triggers when the report finish rendering?

Hi Guys,

I am using FastReport.NET in MVC.

I am displaying the report like this
@ViewBag.WebReport.GetHtml()

Is there a client-side(JavaScript) event that triggers when the report finishes rendering?
If so, how to call it?

Regards,
Naveen

Comments

  • edited November 2017
    So obviously this is SUPER late to the party, but it may help someone down the track. I was faced with the same issue this morning, since I wanted to replace the toolbar and resize and center reports after they had been rendered.

    Disclaimer. This is super hacky, your mileage may vary, and you'll have to be careful when updating fast-report.


    Anyway. My method involves hijacking one of the script functions that fast-report generates. If you crack open your browser console and look at the javascript files you should find one called webresource.axd.

    In here is a function called frReplaceInnerHTML() which appears to be called when fastreport needs to update the page.

    Its currently defined as:
    function frReplaceInnerHTML(repobj, html) {
        var obj = repobj;
        var newObj = document.createElement(obj.nodeName);
        newObj.id = obj.id;
        newObj.className = obj.className;
        newObj.innerHTML = html;
        newObj.style.display = "inline-block";
        newObj.style.width = "100%";
        newObj.style.height = "100%";
        if (obj.parentNode)
            obj.parentNode.replaceChild(newObj, obj);
        else
            obj.innerHTML = html;
        return newObj;
    }
    


    So effectively what I did was create a new frReplaceInnerHTML() function with a call to my own code before the final line return newObj;
    function frReplaceInnerHTML(repobj, html) {
        var obj = repobj;
        var newObj = document.createElement(obj.nodeName);
        newObj.id = obj.id;
        newObj.className = obj.className;
        newObj.innerHTML = html;
        newObj.style.display = "inline-block";
        newObj.style.width = "100%";
        newObj.style.height = "100%";
        if (obj.parentNode)
            obj.parentNode.replaceChild(newObj, obj);
        else
            obj.innerHTML = html;
    
    
    DOAWESOME();
    
    
        return newObj;
    }
    

    To clarify, I dropped the above function into a javascript file that gets retrieved AFTER the original fast-report script loads.


    So yeah, hope this helps.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.