Customize Property Editors
The Property Grid allows you to register custom property editors and use them for built-in and custom properties. The editors are based on question types from SurveyJS Form Library. For instance, this example shows how to use the Single-Line Input question type to implement a text editor limited to 15 characters. This editor is used for the Question name and Short name properties.
Each property editor type is a configuration object that specifies at least two functions:
getJSON
:Function
Returns the JSON configuration object of an underlying SurveyJS Form Library question. This object can include any properties supported by that question.fit
:Function
Specifies one or multiple conditions under which the property editor applies. Returnstrue
if the editor can be used for the current property orfalse
otherwise. In this demo, a custom editor applies when the property'stype
is"shorttext"
.
To implement a custom editor, define an object with the getJSON
and fit
functions and register it in PropertyGridEditorCollection
. The custom editor will be used for the properties that satisfy the fit
conditions. Refer to the Code tab for a code example.