How do I set default width for StiMobileViewer
-
- Posts: 251
- Joined: Fri Feb 04, 2011 11:46 am
- Location: San Diego, CA
How do I set default width for StiMobileViewer
Interactively, I can set the Zoom to Page Width. How can I in C# set this before the report opens? For example, using StiWebViewerFx you can set the StiWebViewerFxOptions.Toolbar.Zoom property.
Also, is there way to have it auto-resize to the window width when the browser window is resized (similar to how StiWebViewerFx works)?
Also, is there way to have it auto-resize to the window width when the browser window is resized (similar to how StiWebViewerFx works)?
Re: How do I set default width for StiMobileViewer
Hello,
Please try to use the following code:
Thank you.
Please try to use the following code:
Code: Select all
<cc2:StiMobileViewer ID="StiMobileViewer1" runat="server" ShowDesignButton="false" FullScreen="true" />
<script type="text/javascript">window.onload = function () { jsStiMobileViewer1.actionEvent("ZoomPageWidth"); }</script>
-
- Posts: 251
- Joined: Fri Feb 04, 2011 11:46 am
- Location: San Diego, CA
Re: How do I set default width for StiMobileViewer
Thanks.
I was also trying to set the Zoom to Page Width when the browser window is resized by using the window.onresize event. This works for the Flash viewer, but the onresize event is never called with the HTML 5 viewer. Is there a sample to show how to do this?
I was also trying to set the Zoom to Page Width when the browser window is resized by using the window.onresize event. This works for the Flash viewer, but the onresize event is never called with the HTML 5 viewer. Is there a sample to show how to do this?
Re: How do I set default width for StiMobileViewer
Hello.
Please, try to use next code:
It resizes the report after the browser is resized.
If you also need to resize the viewer, you should set next property.
Thank you.
Please, try to use next code:
Code: Select all
window.onload = function () { jsStiMobileViewer1.actionEvent("ZoomPageWidth"); }
var resizeTimer;
window.onresize = function () {
if (resizeTimer) clearTimeout(resizeTimer);
resizeTimer = setTimeout(function () { jsStiMobileViewer1.actionEvent("ZoomPageWidth"); }, 300);
}
If you also need to resize the viewer, you should set next property.
Code: Select all
FullScreen="true"
-
- Posts: 251
- Joined: Fri Feb 04, 2011 11:46 am
- Location: San Diego, CA
Re: How do I set default width for StiMobileViewer
Calling the JavaScript actionEvent("ZoomPageWidth") calls the Page_Load again after the report is completely loaded, which re-loads all of the data from the SQL source, which causes the report to take longer to display (it basically runs the report twice on the first load). Is there a way to set the default width prior to the report rendering?
Re: How do I set default width for StiMobileViewer
Hello.
To avoid this you should add if statement in Page_Load.
Thank you.
To avoid this you should add if statement in Page_Load.
Code: Select all
protected void Page_Load(object sender, EventArgs e)
{
if (Page != null && !Page.IsPostBack)
{
StiReport report = new StiReport();
report.Load(appDirectory + "\\Report.mrt");
DataSet data = new DataSet();
data.ReadXmlSchema(appDirectory + "\\Data\\Demo.xsd");
data.ReadXml(appDirectory + "\\Data\\Demo.xml");
report.RegData(data);
StiMobileViewer1.Report = report;
}
}
It's impossible to get size of the browser window on server side. So this option could be set on client-side. After this the report with necessary size is requested from server.jay@bplogix.com wrote:Is there a way to set the default width prior to the report rendering?
Thank you.
-
- Posts: 251
- Joined: Fri Feb 04, 2011 11:46 am
- Location: San Diego, CA
Re: How do I set default width for StiMobileViewer
"To avoid this you should add if statement in Page_Load"
When I display my report, it might actually be from a postback. So I cant simply check the Page.IsPostBack flag. The first time the report is actually viewed is from my postback.
The flash viewer does a lot of postbacks, but they add things to the URL (stimulreport_btnimage, sr_print, stimulsoft_viewerfx, stimulsoft_guid) that I look for and skip this logic in those cases. But with the StiMobileViewer it seems that it posts back with no additional data on the URL for me to know to skip loading data.
How else can I determine if the postback is just an internal reporting postback rather than one that I should load my SQL data?
When I display my report, it might actually be from a postback. So I cant simply check the Page.IsPostBack flag. The first time the report is actually viewed is from my postback.
The flash viewer does a lot of postbacks, but they add things to the URL (stimulreport_btnimage, sr_print, stimulsoft_viewerfx, stimulsoft_guid) that I look for and skip this logic in those cases. But with the StiMobileViewer it seems that it posts back with no additional data on the URL for me to know to skip loading data.
How else can I determine if the postback is just an internal reporting postback rather than one that I should load my SQL data?
Re: How do I set default width for StiMobileViewer
Hello.
Please, try to check postback from Mobile Viewer this way:
Thank you.
Please, try to check postback from Mobile Viewer this way:
Code: Select all
if (Page.Request.Params["__CALLBACKPARAM"] != null && Page.Request.Params["__CALLBACKPARAM"].IndexOf("cacheReportGuid") > 0)
{
}
-
- Posts: 251
- Joined: Fri Feb 04, 2011 11:46 am
- Location: San Diego, CA
Re: How do I set default width for StiMobileViewer
That works great, thanks.
What about with the StiWebViewer ... does that use any caching for page forward/next/zoom? Or do we need to re-load all the data for these events using that viewer?
What about with the StiWebViewer ... does that use any caching for page forward/next/zoom? Or do we need to re-load all the data for these events using that viewer?
Re: How do I set default width for StiMobileViewer
Hello.
Yes, it uses server-side cache.
The report is rendered on server and stored in cache.
In StiWebViewer you see the report exported to HTML. When you go to the next page, this page is taken from cache, is exported to HTML and is shown in Viewer.
Thank you.
Yes, it uses server-side cache.
The report is rendered on server and stored in cache.
In StiWebViewer you see the report exported to HTML. When you go to the next page, this page is taken from cache, is exported to HTML and is shown in Viewer.
Thank you.