Skip to content

[Question] Setting default properties for custom widget #143

@mkopinsky

Description

@mkopinsky

I am creating (for use in survey-creator) a custom widget based on multipletext, except that the set of items are predefined, and shouldn't be editable by the user.

I'm able to define the class and set items to non-editable (mostly*) via the following:

  activatedByChanged: function (activatedBy) {
    // We are creating a new class and derived it from multipletext question type, but with the 'items' editor hidden
    Survey.JsonObject.metaData.addClass(
      "bloodpressure", [
        {
          name: 'items',
          visible: false,
        },
      ],
      null,
      "multipletext"
    );
  }

and pass an initial JSON to editor.toolbox.addItems(...), but it would be great if there were a way to set the items from within the custom widget definition itself.

Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions