Create Custom Adorners
Adorners are interactive design-surface controls placed within a question area. Adorners allow users to quickly execute the most common actions: duplicate a question, mark a question as required, or delete it. This demo shows how to customize built-in adorners and create custom adorners.
Create a Button Adorner
A button adorner executes a simple action on click. To create a button adorner, follow the steps below:
Handle the
onDefineElementMenuItems
event.
This event is raised when Survey Creator renders adorners on the design surface.Create an
Action
instance.
Pass anIAction
configuration object to theAction
constructor. This object describes an action item rendered as a button adorner.Add the
Action
instance to theoptions.items
array.
This demo shows how to create a custom Read-Only button adorner. Refer to the code listing for more information.
Create a Drop-Down Adorner
A drop-down adorner opens a drop-down menu on click. The following instructions describe how to create a drop-down adorner:
Handle the
onDefineElementMenuItems
event.Create an
Action
instance.
Drop-down adorners have a dedicatedcreateDropdownActionModel()
helper function that generatesAction
instances based onIAction
andIActionDropdownPopupOptions
configuration objects. Import this function fromsurvey-core
and passIAction
andIActionDropdownPopupOptions
objects to it.Add the
Action
instance to theoptions.items
array.
In this demo, a custom Sort Order drop-down adorner lets users specify the order of items in choice-based questions. For details about implementation, view code listings for Angular, React, Vue, jQuery, or Knockout.