Survey Creator Toolbox Categories
The Toolbox is a UI element that displays available question and panel types. To add a question or panel to your survey, simply click it in the Toolbox or drag and drop the desired survey element onto the design surface. This example shows how to arrange questions and panels in the Toolbox into multiple categories.
Note that the Toolbox displays categories only in full display mode. This mode is enabled automatically when Survey Creator has sufficient width. If you want to use the full mode at all times, set the
forceCompact property to
To organize Toolbox items into categories, call the
changeCategories() method. It accepts an array of objects with the following fields:
The name of the item that should be grouped. Refer to the
getType()method description for a list of accepted values.
A category for this item.
Ungrouped items fall into the General category. You can use localization capabilities to change its caption. In this demo, the General category is renamed to "Others". Note that the code that changes the caption goes before the code that instantiates Survey Creator.
Created categories are stored in the categories array of the Toolbox. You can access and modify this array. For example, code in this demo moves the "Others" (General) category to the end.
Control the Behavior
The Toolbox also has the following properties to control the behavior of categories:
Allows users to expand more than one category at a time. If this property is
false, the currently expanded category collapses when a user expands another category.
Expands all categories. Users cannot collapse them.
Since these two properties are incompatible with each other, this example demonstrates only the