Page 1 of 1

Adding custom button into designer Toolbar

Posted: Tue Jun 14, 2022 8:12 am
by sivaw38382
Hi,
I followed this code to add a custom button into designer/editor toolbar but he show me some error when i remove the 3rd parameter, how can i add a button without image?
Thank you in advance.

Re: Adding custom button into designer Toolbar

Posted: Wed Jun 15, 2022 9:17 am
by Max Shamanov
Hello,

Please check the following code:

Code: Select all

var toolBarRow = designer.jsObject.options.toolBar.firstChild.tr[0];
                    var customButton = designer.jsObject.StatusPanelButton("customButton1", "Test", null, null, null, 30, 30);
                    var buttonCell = document.createElement("td");
                    buttonCell.className = "stiDesignerToolButtonCell";
                    buttonCell.appendChild(customButton);
                    toolBarRow.insertBefore(buttonCell, toolBarRow.childNodes[3]);
                    customButton.action = function () {
                        alert("Button clicked!");
                    }
Thank you.

Re: Adding custom button into designer Toolbar

Posted: Thu Jun 16, 2022 9:09 am
by sivaw38382
Hi, it works, thank you so much.

Re: Adding custom button into designer Toolbar

Posted: Thu Jun 16, 2022 1:33 pm
by Max Shamanov
Hello,

You are welcome!