Implement a Custom Expression Property
Expressions allow survey creators to manage data flow and visual elements within a survey dynamically. Most survey elements have built-in expression properties (visibleIf, enableIf, setValueExpression, etc.). This demo shows how to implement a custom expression property. This property controls the visibility of the table header in a Single-Select Matrix question.
To implement a custom expression property, follow the steps below:
Add a custom property to a desired class.
CallSerializer'saddPropertymethod, passing a class name and a JSON object with property settings.Specify the property's
nameandtype.
Use the"condition"type for Boolean expressions or the"expression"type for other expressions.Specify the
onExecuteExpressionfunction.
This function will be called each time a specified expression is evaluated. This function should assign the evaluation result to one of the class instance properties. For example, in this demo, the result is assigned to theshowHeaderproperty of a Single-Select Matrix.
Refer to the code listing for a code example.