Question T16351
Visible to All Users

Component

created a year ago (modified a year ago)

Hi team,
I want to add like this as an option in question type and these both options will have existing template names in drop-down which are component in other files whenever it will be clicked by user that component will be called so how can I do that, I have attached an image below.
Thanks!

Answers approved by surveyjs Support

created a year ago

Hello,
Please follow these steps to achieve your goal.

  • Use the creator.onDefineElementMenuItems event to register custom adorner actions. To initialize a drop-down action and populate its item list, use the createDropdownActionModel function from the "survey-core" module. For more details, please visit Create Custom Adorners.
  • Once a user selects a new template, you can modify a question definition and apply some new configuration. For this, use the question.fromJSON function and pass a JSON object which defines a new question configuration.

I hope this information helps. Please let me know if you have further questions.