Source code: Survey setup


Survey.defaultBootstrapCss.navigationButton = "btn btn-primary";
Survey.Survey.cssType = "bootstrap";
//Hide Test Survey tab
var options = { showTestSurveyTab: false };
var editor = new SurveyEditor.SurveyEditor("editorElement", options);
//Add custom button in the toolbar
editor.toolbarItems.push({
        id: "custom-preview",
        visible: true,
        title: "Survey Preview",
        action: function() {
            var windowElement = document.getElementById("surveyContainerInPopup");
            var testSurveyModel = new Survey.Model(editor.getSurveyJSON());
            testSurveyModel.render("surveyContainerInPopup");
            $("#modalSurvey").modal("show");
        }
});

Question Toolbar API

toolbarItems property: knockout observable array of boolbar items

Use toolbarItems for toolbar customizations. Only the given toolbar items will appear in the Toolbar

Question Toolbar Item properties

{
    id: string;
    visible: boolean | KnockoutObservable(boolean);
    title: string | KnockoutObservable(string);
    action: Function;
}
  • id – The required attribute. The unique toolbar item id.
  • visible – The required attribute. Controls visibility of the toolbar item.
  • title – The required attribute. Toolbar buuton title.
  • action – The required attribute. Function will be called on button click.

results matching ""

    No results matching ""