Reorder answers, columns, and rows using scripting
Use scripting to reorder child elements in questions.
You can reorder child elements in the following question types:
- Single Choice
- Multiple Choice
- Single Choice Grid
- Multiple Choice Grid
- Allocation
- Rank Order
Function or property | Description |
---|---|
|
Sets the order of child elements based on the authored indexes (zero-based), and returns an array with all the elements' authored indexes. If the authored index is not present in the array because of masking or any other reason, it will be ignored. If the number of authored indexes provided is less than the number of elements in the array, the first matches will be ordered first. |
Function or property | Description |
---|---|
|
Reorders answers (zero-based).
grid.elements[0] references the answers.
|
grid.elements[1].reorderElements([...])
|
Reorders statements (zero-based).
grid.elements[1] references the statements.
|
grid.reorderElements([...])
to reorder the entire grid.
You can only use
grid.elements[0]
or
grid.elements[1]
to reorder answers or statements,
respectively.
Example | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
A Single Choice question has 5 answer options. 2 answers are masked. The zero-based authored indexes range from 0 to 4.
|