QuestionnaireItemViewItem

data class QuestionnaireItemViewItem(questionnaireItem: <ERROR CLASS>, questionnaireResponseItem: <ERROR CLASS>, validationResult: ValidationResult, answersChangedCallback: (<ERROR CLASS>, <ERROR CLASS>, List<<ERROR CLASS>>) -> Unit, resolveAnswerValueSet: suspend (String) -> List<<ERROR CLASS>>)

Data item for QuestionnaireItemViewHolder in RecyclerView.

The view should use questionnaireItem, answers, answerOption, and validationResult 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 answer only)

  • addAnswer (for repeated answers only)

  • removeAnswer (for repeated answers only)

  • clearAnswer (for both single and repated answers)

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

questionnaireItem

the Questionnaire.QuestionnaireItemComponent in the Questionnaire

questionnaireResponseItem

the QuestionnaireResponse.QuestionnaireResponseItemComponent in the QuestionnaireResponse

validationResult

the ValidationResult of the answer(s) against the questionnaireItem

answersChangedCallback

the callback to notify the view model that the answers have been changed for the QuestionnaireResponse.QuestionnaireResponseItemComponent

resolveAnswerValueSet

the callback to resolve the answer value set and return the answer options

Constructors

Link copied to clipboard
fun QuestionnaireItemViewItem(questionnaireItem: <ERROR CLASS>, questionnaireResponseItem: <ERROR CLASS>, validationResult: ValidationResult, answersChangedCallback: (<ERROR CLASS>, <ERROR CLASS>, List<<ERROR CLASS>>) -> Unit, resolveAnswerValueSet: suspend (String) -> List<<ERROR CLASS>> = { emptyList() })

Functions

Link copied to clipboard
fun clearAnswer()
Link copied to clipboard
fun isAnswerOptionSelected(answerOption: <ERROR CLASS>): Boolean
Link copied to clipboard
fun setAnswer(questionnaireResponseItemAnswerComponent: <ERROR CLASS>)

Properties

Link copied to clipboard
var answers: List<<ERROR CLASS>>

A read-only list of answers to be rendered in the view.

Link copied to clipboard
val questionnaireItem: <ERROR CLASS>
Link copied to clipboard
val validationResult: ValidationResult