Questionnaire View Item
Data item for QuestionnaireItemViewHolder in RecyclerView.
The view should use questionnaireItem, answers, enabledAnswerOptions, validationResult and enabledDisplayItems to render the data item in the UI. The view SHOULD NOT mutate the data using these properties.
The view should use the following answer APIs to update the answer(s):
setAnswer (for single and repeated answers)
clearAnswer (for single and repeated answers)
addAnswer (for repeated answers only)
removeAnswer (for repeated answers only)
Updates to the answers using these APIs will invoke answersChangedCallback to notify the view model that the answer(s) have been changed. This will trigger a re-render of the RecyclerView UI.
Parameters
the ValidationResult of the answer(s) against the questionnaireItem
the callback to notify the view model that the answers have been changed for the QuestionnaireResponse.QuestionnaireResponseItemComponent
the enabled answer options in questionnaireItem
the inclusive lower bound on the range of allowed answer values, that may be used for widgets that check for bounds and change behavior based on the min allowed answer value, e.g the Slider widget
the inclusive upper bound on the range of allowed answer values, that may be used for widgets that check for bounds and change behavior based on the max allowed answer value, e.g the Slider widget
the draft input that cannot be stored in the QuestionnaireResponse.
the enabled display items in the given questionnaireItem
configuration to show asterisk, required and optional text in the header view.
Constructors
Properties
A read-only list of answers to be rendered in the view.
Fetches the question title that should be displayed to user. The title is first fetched from Questionnaire.QuestionnaireResponseItemComponent (derived from cqf-expression), otherwise it is derived from localizedTextSpanned of QuestionnaireResponse.QuestionnaireItemComponent
Functions
Adds an answer to the existing answers and removes the draft answer.
Returns a given answer (The respondent's answer(s) to the question) along with displayString if question is answered else 'Not Answered'
Clears existing answers and any draft answer.
Removes an answer from the existing answers, as well as any draft answer.
Updates the answers. This will override any existing answers and removes the draft answer.
Updates the draft answer stored in QuestionnaireViewModel
. This clears any actual answer for the question.