Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions R/data_extract_filter_module.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,22 @@ data_extract_filter_srv <- function(id, datasets, filter) {
force(filter)
logger::log_trace("data_extract_filter_srv initialized with: { filter$dataname } dataset.")

ns <- session$ns

isolate({
# when the filter is initialized with a delayed spec, the choices and selected are NULL
# here delayed are resolved and the values are set up
teal.widgets::updateOptionalSelectInput(
session = session,
inputId = "col",
choices = filter$vars_choices,
selected = filter$vars_selected
selected = shiny::restoreInput(ns("col"), filter$vars_selected)
)
teal.widgets::updateOptionalSelectInput(
session = session,
inputId = "vals",
choices = filter$choices,
selected = filter$selected
selected = shiny::restoreInput(ns("vals"), filter$selected)
)
})

Expand Down Expand Up @@ -115,14 +117,17 @@ data_extract_filter_srv <- function(id, datasets, filter) {
session = session,
inputId = "vals",
choices = paste0(input$val, "$_<-_random_text_to_ensure_val_will_be_different_from_previous"),
selected = paste0(input$val, "$_<-_random_text_to_ensure_val_will_be_different_from_previous")
selected = shiny::restoreInput(
ns("vals"),
paste0(input$val, "$_<-_random_text_to_ensure_val_will_be_different_from_previous")
)
)

teal.widgets::updateOptionalSelectInput(
session = session,
inputId = "vals",
choices = choices,
selected = selected
selected = shiny::restoreInput(ns("vals"), selected)
)
}
)
Expand Down
4 changes: 3 additions & 1 deletion R/data_extract_single_module.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ data_extract_single_srv <- function(id, datasets, single_data_extract_spec) {
function(input, output, session) {
logger::log_trace("data_extract_single_srv initialized with dataset: { single_data_extract_spec$dataname }.")

ns <- session$ns

# ui could be initialized with a delayed select spec so the choices and selected are NULL
# here delayed are resolved
isolate({
Expand All @@ -86,7 +88,7 @@ data_extract_single_srv <- function(id, datasets, single_data_extract_spec) {
session = session,
inputId = "select",
choices = resolved$select$choices,
selected = resolved$select$selected
selected = shiny::restoreInput(ns("select"), resolved$select$selected)
)
})

Expand Down