Add Custom Button/Group To Web Designer Toolbar

Stimulsoft Reports.WEB discussion
Post Reply
ChrisHolland
Posts: 45
Joined: Tue May 21, 2019 1:44 pm

Add Custom Button/Group To Web Designer Toolbar

Post by ChrisHolland »

Hi, is there a way to add a Custom Button and/or Group To a Web Designer Toolbar, like the example here:

https://www.stimulsoft.com/en/samples/a ... the-viewer

but for the designer not the Viewer?

Chris Holland
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Add Custom Button/Group To Web Designer Toolbar

Post by HighAley »

Hello.

The Designer is much more complicated.
What kind of button do you want to add there?
And where do you want to add it?

Thank you.
ChrisHolland
Posts: 45
Joined: Tue May 21, 2019 1:44 pm

Re: Add Custom Button/Group To Web Designer Toolbar

Post by ChrisHolland »

I would like to add an extra option (either button or menu item) that will allow to have a "Custom Save" function that I can call. Probably under the "File" toolbar group

I currently save my reports to a data table as a stream but would like the option to be able to save to a file as well.
Lech Kulikowski
Posts: 7341
Joined: Tue Mar 20, 2018 5:34 am

Re: Add Custom Button/Group To Web Designer Toolbar

Post by Lech Kulikowski »

Hello,

Please try to check the following code:

Code: Select all

<body>
    <div onclick="aaa()">Load Report</div>
    <form id="form1" runat="server">
    <div>
        <cc3:StiWebDesigner runat="server" ID="StiWebDesigner1" />
    </div>
    </form>
    <script>
        //where jsStiWebDesigner1 - "js" + designer ID
        var toolBarRow = jsStiWebDesigner1.options.toolBar.firstChild.tr[0];

        //Add images for custom buttons to designer images collection
        jsStiWebDesigner1.options.images["ImageForCustomButton1"] = "https://www.stimulsoft.com/favicon.ico"; //For example

        var customButton = jsStiWebDesigner1.StatusPanelButton("customButton1", null, "ImageForCustomButton1", null, null, 30, 30);
        customButton.image.style.width = customButton.image.style.height = "16px";
        var buttonCell = document.createElement("td");
        buttonCell.className = "stiDesignerToolButtonCell";
        buttonCell.appendChild(customButton);

        toolBarRow.insertBefore(buttonCell, toolBarRow.childNodes[3]);

        customButton.action = function () {
            alert("Button clicked!");
        }
    </script>
</body>
Thank you.
ChrisHolland
Posts: 45
Joined: Tue May 21, 2019 1:44 pm

Re: Add Custom Button/Group To Web Designer Toolbar

Post by ChrisHolland »

That is working fine thanks
Lech Kulikowski
Posts: 7341
Joined: Tue Mar 20, 2018 5:34 am

Re: Add Custom Button/Group To Web Designer Toolbar

Post by Lech Kulikowski »

Hello

We are always glad to help you!

Thank you.
Post Reply