SSRS - Javascript Report load event
dom-events, javascript, reporting-services
Solution
Javascript support is minimal at best. Sadly these controls are still behind with the times on most fronts. You can find what is exposed and documented here:
http://msdn.microsoft.com/en-us/library/dd756405(VS.100).aspx
Luckily for you there is a get_isLoading() function you can call:
http://msdn.microsoft.com/en-us/library/dd756413(v=vs.100).aspx
Try something like this:
(function() {
var onLoad = function() {
// Do something...
};
var viewerReference = $find("ReportViewer1");
setTimeout(function() {
var loading = viewerReference.get_isLoading();
if (!loading) onLoad();
},100);
})();
Problem
I'm embedding a Report into an iframe (the report is fetched with .NET ReportingServices) I'd like to launch a Javascript function once the report is loaded. I tried: ``` window.addEventListener("load", ...) ``` But as the report result is loaded with Javascript, `window.load` is triggered before the report is effectively loaded. Are there some Javascript functions exposed that would allow me to handle the report load? Like: ``` the_report.loaded(function () { alert(document.height); }); ``` By the way the aim is to get the final rendered document height.