Adjust report size based on available space when resizing

Stimulsoft Reports.JS discussion
Post Reply
rjorge99
Posts: 12
Joined: Tue Feb 28, 2023 6:24 pm

Adjust report size based on available space when resizing

Post by rjorge99 »

Hi,

Ive been trying to get to work the Viewer in responsive mode, I mean, if I resize the window, I would like that the report adapts to the space.

Looking thru past posts, I found the use of this option:

Code: Select all

options.toolbar.zoom = Stimulsoft.Viewer.StiZoomMode.PageWidth;
But that creates a zoom to the report making it look bigger in all aspects, and not stretching only the textboxes or something similar. I attatch two images,

1.- Normal mode
2.- With the zoom option

Code: Select all

options.toolbar.zoom = Stimulsoft.Viewer.StiZoomMode.PageWidth;
3.- With the zoom option but with resized window, where part of the report is lost because overflow

I try using overflow: scrool with out success.

How could I make it work in case the user resizes the window, and still make the report information visible ?

I think the use of zoom is not the correct option ?

Thanks
Attachments
1.jpg
1.jpg (60.1 KiB) Viewed 1057 times
2.jpg
2.jpg (82.2 KiB) Viewed 1057 times
3.jpg
3.jpg (103.09 KiB) Viewed 1057 times
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: Adjust report size based on available space when resizing

Post by Lech Kulikowski »

Hello,

> 3.- With the zoom option but with resized window, where part of the report is lost because overflow

Could you explain your issue in more detail?

Thank you.
rjorge99
Posts: 12
Joined: Tue Feb 28, 2023 6:24 pm

Re: Adjust report size based on available space when resizing

Post by rjorge99 »

Hi,

I've been playing around with different options these days.

Currently I have:

Code: Select all

options.toolbar.zoom = Stimulsoft.Viewer.StiZoomMode.PageWidth;
With that the report takes the full width.

What I can't find how to do is that, if the user resizes the window on the Y axis, the report doesn't shrink and does not adapts to the new width, a scroll appears and the user needs to scroll to see the right end part of the report.

Is ther a way to make the report to adapt to the width of the window if it is resized by the user?

Thanks
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: Adjust report size based on available space when resizing

Post by Lech Kulikowski »

Hello,

Please try to check the following code:

Code: Select all

<form id="form1" runat="server">
        <cc3:StiWebDesigner runat="server" ID="StiWebDesigner1" OnGetReport="StiWebDesigner1_GetReport" OnSaveReport="StiWebDesigner1_SaveReport" />
    </form>
    <script>
        jsStiWebDesigner1.onready = function () {
            window.onresize = function () {
                clearTimeout(jsStiWebDesigner1.resizeTimer);

                jsStiWebDesigner1.resizeTimer = setTimeout(function () {                    
                    var pageWidthButton = jsStiWebDesigner1.options.buttons.zoomPageWidth;
                    pageWidthButton.action();
                }, 50);
            }
        }
    </script>
Thank you.
Post Reply