Page 1 of 1

Toolbar close button in Report viewer

Posted: Fri Aug 05, 2016 6:29 pm
by rodrigorodrigues
I was looking on documentation for a button at toolbar to close the report itself, I didn't find!

Code: Select all

var options = new Stimulsoft.Viewer.StiViewerOptions();
        options.height = "100%";
        options.appearance.scrollbarsMode = true;
        options.toolbar.showDesignButton = true;
it was great if we should use like

Code: Select all

options.toolbar.showCloseButton = true;
is there any option to close the Report Viewer or how can I insert this feature?

Re: Toolbar close button in Report viewer

Posted: Sun Aug 07, 2016 11:41 am
by peda
You can close with JS easy

Code: Select all

viewer.jsObject.CloseReport();

Re: Toolbar close button in Report viewer

Posted: Sun Aug 07, 2016 12:41 pm
by rodrigorodrigues
Thank you, this is the action to close, how to insert a button in toolbar? Into this button will insert this code, how to make a button appear on toolbar?

Re: Toolbar close button in Report viewer

Posted: Tue Aug 09, 2016 6:19 am
by HighAley
Hello.

You could use next code to add button on the toolbar.

Code: Select all

var userButton = jsStiWebViewer1.SmallButton("userButton", "My Button", "emptyImage"); // (name, captionText, imageName, toolTip, arrow, styleName);
userButton.image.src = "icon.png";
userButton.action = function () { alert("My Button Event"); }

var toolbarTable = jsStiWebViewer1.controls.toolbar.firstChild.firstChild;
var buttonsTable = toolbarTable.rows[0].firstChild.firstChild;
var userButtonCell = buttonsTable.rows[0].insertCell(0);
userButtonCell.className = "stiJsViewerClearAllStyles";
userButtonCell.appendChild(userButton);
Thank you.

Re: Toolbar close button in Report viewer

Posted: Fri Aug 26, 2016 5:47 pm
by rodrigorodrigues
peda wrote:You can close with JS easy

Code: Select all

viewer.jsObject.CloseReport();

The button is showing with HighAley code, but the function to close the report didn't work,

Code: Select all

viewer.jsObject.CloseReport()

Code: Select all

userButton.action = function () {
            viewer.jsObject.CloseReport();
        }

error : viewer.jsObject.CloseReport is not a function
The object jsObject exists on viewer instance but CloseReport doesn't exists on jsObject

I need to close the Report Viewer, actually, I think this button should be default

Re: Toolbar close button in Report viewer

Posted: Mon Aug 29, 2016 10:52 am
by Alex K.
Hello,

Please try to use the following code:

Code: Select all

userButton.action = function () {
        //if you want close only report in the viewer, use this code
        this.jsObject.controls.reportPanel.clear();
        this.jsObject.reportParams.pageNumber = 0;
        this.jsObject.reportParams.pagesCount = 0;
        this.jsObject.controls.toolbar.changeToolBarState();

        //if you want close viewer, use this code
        this.jsObject.controls.viewer.parentNode.removeChild(this.jsObject.controls.viewer);

        //if you want go to previews page, use this code
        history.back();
    }
Thank you.

Re: Toolbar close button in Report viewer

Posted: Mon Nov 14, 2016 3:27 am
by lampsea12
How can i add a close button when use angularJS 1.x,
I can't implement jsStiWebViewer1!

Re: Toolbar close button in Report viewer

Posted: Tue Nov 15, 2016 8:07 am
by HighAley
Hello.

Sorry, we don't have special solution for the AngularJS.
Please, try to use the same code.

Thank you.