Question T3320
Visible to All Users

How to customize a widget

created 5 years ago (modified 5 years ago)

[Ticket cloned from T3216: Add property]

I am trying to customize a widget but  its not applying to my widget.

widgets.icheck(SurveyKo);
widgets.select2(SurveyKo);
widgets.inputmask(SurveyKo);
widgets.jquerybarrating(SurveyKo);
//widgets.jqueryuidatepicker(Survey);
widgets.nouislider(SurveyKo);
widgets.select2tagbox(SurveyKo);
widgets.signaturepad(SurveyKo);
widgets.sortablejs(SurveyKo);
widgets.ckeditor(SurveyKo);
widgets.autocomplete(SurveyKo);
widgets.bootstrapslider(SurveyKo);

export default {
  name: "survey-creator",

data() {
    return { txtname: "" };
  },

mounted() {

debugger

var categories = [
      "real madrid",
      "reaction time",
      "time analysis",
      "heart rate"
    ];

SurveyKo.Serializer.addProperty("question", {
      name: "category1",
      choices: categories
    });

SurveyKo
    .Serializer
    .addProperty("question", {
        name: "tag:number",
        default: 1
    });

SurveyCreator.StylesManager.applyTheme("bootstrap");

let options = { showEmbededSurveyTab: true, showLogicTab: true };

let surveyCreator = new SurveyCreator.SurveyCreator(
      "surveyCreatorContainer",
      options
    );

surveyCreator.text= JSON.stringify({
    elements: [
        {
            type: "textwithbutton",
            name: "q1",
            placeHolder: "put some text here",
            buttonText: "Custom button text"

}
    ]
});

On 1/24/2020 1:56 PM, Support Support wrote:

Answers approved by surveyjs Support

created 5 years ago

Hello,

Could you please clarify what exactly do you want to achieve? And any working sample illustrating the issue will be highly appreciated

Thanks, Alex
SurveyJS Team

    Show previous comments (8)

      Hello,

      The reference repository I gave you above demonstrates how to solve your task. The custom widget file is imported into VueJS component via this line. And this line initializes the widget. After that you can use your own new custom widget type in SurveyJSON. Also you can enable your own custom widget in SurveyCreator via code like this customWidget(SurveyKo); near to customWidget(SurveyVue); line

      Thanks, Alex
      SurveyJS Team

        Hello!!

        What is the function  event for adding page on surveyjs?

        On 1/27/2020 12:27 PM, Support Support wrote:

          Hello,

          I've created a separate ticket on your behalf (T3340: What is the function  event for adding page on surveyjs). It has been placed in our processing queue and will be answered shortly.