Create Survey Response Table Output
server_response.Rd
Sets up server-side logic for displaying survey responses in a themed DataTable. Handles rendering, visibility control, and theme-based styling.
Usage
server_response(
output,
rv,
show_response = TRUE,
theme_mode = "light",
theme_color = "#003594"
)
Arguments
- output
Shiny output object.
- rv
Reactive values object containing:
survey_completed
: Boolean indicating survey completionloading
: Boolean for loading statesurvey_responses
: Data frame of responseserror_message
: Error message string if any
- show_response
Logical. Display response table. Default:
FALSE
.- theme_mode
String. Color mode, either "light" or "dark". Default: "light".
- theme_color
String. Hex color code for primary theme.
Details
Creates two reactive outputs:
surveyResponseTable
: Themed DataTable of responsesshowResponseTable
: Visibility control
Table displays when:
Survey is completed
Not loading
No errors present
show_response
isTRUE
Theme styling:
Light mode: White background, dark text
Dark mode: Dark background, light text
Examples
if (FALSE) { # \dontrun{
server <- function(input, output, session) {
rv <- reactiveValues(
survey_completed = FALSE,
loading = FALSE,
survey_responses = data.frame(),
error_message = NULL
)
server_response(
output,
rv,
show_response = TRUE,
theme_mode = "light",
theme_color = "#003594"
)
}
} # }