I have a mvc 5 project with to report views
each in it own tabs
the second is always zoom out
is there a way to avoid this
see images
<div id="tabs"><ul><li><a href="#tabs-1">BEKRÆFTIGELSE</a></li><li><a href="#tabs-2">OPLYSNINGER TIL OMVISER</a></li></ul><div id="tabs-1"><div style="text-align:center; width:850px" id="viewer1"></div></div><div id="tabs-2"><div style="text-align:center; width:850px" id="viewer2"></div></div></div>
var rangeParameters = [{ Key: "ID", Value: 1 }];$(document).ready(function () {$("#tabs").tabs();var _ID = '@ViewBag.ID';var bekraeft = '@ViewBag.Bekraeft';var sxs = '@ViewBag.SXS';rangeParameters[0].Value = _ID;$("#viewer2").igReportViewer({renderSettings: {definitionUri: "/Reports/Oplysninger_Omviser.igr",serviceEndpointUri: "/ReportService1.svc/ajaxAddress/"},parameters: rangeParameters,width: 800,height: 550,pageFit: 'fitToWidth'});if (bekraeft != 'Nej') {$("#viewer1").igReportViewer({renderSettings: {definitionUri: "/Reports/Bekraeftigelse.igr",serviceEndpointUri: "/ReportService1.svc/ajaxAddress/"},parameters: rangeParameters,width: 800,height: 550,pageFit: 'fitToWidth'});}});
Hello Christian,
Thank you for posting in our forum.
The second report that’s in the hidden tab will be initiated when the page loads together with the one from the first tab.
However due to the following setting:
pageFit: 'fitToWidth'
When its initially created inside a hidden container, the content will not be properly fitted.
You would need to refresh it in order for it to be properly fitted.
For example you can use the activate event of the tab and when the second tab is selected refresh the second report viewer:
$("#tabs").on("tabsactivate", function (event, ui) {
if (ui.oldTab.attr("tabindex") == 0) {
$("#viewer2").igReportViewer("refresh");
}
});
Let me know if you have any questions.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
http://ko.infragistics.com/support
It Works
the only problem is now when it refesh the view scrolls down to the buttom of the page
You could programmatically set the scrollbar to be at the top.
For example:
$(".scrollPanelDiv").scrollTop(0);
Also if you’d prefer not to refresh the whole report viewer you could programmatically set the zoom scale again when the tab changes using the fitToWidth method. For example:
$("#viewer1").igReportViewer("fitToWidth");
$("#viewer2").igReportViewer("fitToWidth");
Let me know if you have any questions or concerns.