StiMvcDesigner кастомная кнопка

Обсуждение Stimulsoft Reports.WEB
Ответить
vyaremko
Сообщения: 7
Зарегистрирован: 28 апр 2017, 11:53

StiMvcDesigner кастомная кнопка

Сообщение vyaremko »

Здраствуйте,

Для вьювера єсть пример создания кастомной кнопки а для дизайнера нету, можно получити такой пример?
Aleksey
Сообщения: 2777
Зарегистрирован: 22 апр 2010, 06:57

Re: StiMvcDesigner кастомная кнопка

Сообщение Aleksey »

Здравствуйте,

Вы можете использовать следующий код:

Код: Выделить всё

<body>
    <form id="form1" runat="server">
    <div>
        <cc3:StiWebDesigner runat="server" ID="StiWebDesigner1"
            ShowPageButton="false" CloudMode="false" 
            Theme="Office2013WhiteTeal"
            Localization="en.xml"
            OnGetReport="StiWebDesigner1_GetReport"
            OnCreateReport="StiWebDesigner1_CreateReport"
            OnOpenReport="StiWebDesigner1_OpenReport"
            OnSaveReport="StiWebDesigner1_SaveReport"
            OnPreviewReport="StiWebDesigner1_PreviewReport"
            OnExit="StiWebDesigner1_Exit" />
    </div>
    </form>
    <script type="text/javascript">
        //Example add custom button to insert toolbar panel

        if (!jsStiWebDesigner1.options.insertPanel) jsStiWebDesigner1.InitializeInsertPanel(); //where object jsStiWebDesigner1 - "js" + DesignerId; 
        var insertPanel = jsStiWebDesigner1.options.insertPanel;

        //Add buttons group to insert panel
        var buttonsGroup = jsStiWebDesigner1.GroupBlock("buttonsGroup1", "Group1"); //groupName, groupText
        var buttonsGroupTable = jsStiWebDesigner1.GroupBlockInnerTable();
        buttonsGroup.container.appendChild(buttonsGroupTable);

        //Add images for custom buttons to designer images collection
        jsStiWebDesigner1.options.images["ImageForCustomButton1"] = "https://www.stimulsoft.com/images/blocks/ultimate-buttons/logo.png"; //For example

        //Add big button to buttons group
        var customBigButton = jsStiWebDesigner1.BigButton("customButton1", null, "Custom Text", "ImageForCustomButton1", "Tooltip for customButton1", null, jsStiWebDesigner1.GetStyles("StandartBigButton"));
        //name, groupName, caption, imageName, toolTip, arrow, styles

        buttonsGroupTable.addCell(customBigButton).style.padding = "2px";
        
        //customBigButton onclick event
        customBigButton.action = function () {
            alert("customButton was pressed!");
        }

        //Add buttonsGroup and separator to customPanel
        insertPanel.firstChild.addCell(buttonsGroup);
        insertPanel.firstChild.addCell(jsStiWebDesigner1.GroupBlockSeparator());
    </script>
</body>
Спасибо.
Ответить