1

i have some a bunch of user inputs built using selectizeGroupUI from shinywidgets package .When i try to bookmark them i get no saved values.it seems hard to bookmark selectizeGroupUI.Does any one can help me?.

library(shiny)
library(shinyWidgets)

data("mpg", package = "ggplot2")

ui <- function(request) {
   fluidPage(
      fluidRow(
         column(
            width = 10,
            offset = 1,
            bookmarkButton(),
            tags$h3("Filter data with selectize group"),
            panel(
               selectizeGroupUI(
                  id = "my-filters",
                  params = list(
                     manufacturer = list(inputId = "manufacturer", title = "Manufacturer:"),
                     model = list(inputId = "model", title = "Model:"),
                     trans = list(inputId = "trans", title = "Trans:"),
                     class = list(inputId = "class", title = "Class:")
                  )
               ), status = "primary"),
            DT::dataTableOutput(outputId = "table"))))
}

server <- function(input, output, session) {
   vals <- reactiveValues(sum = NULL)
   
   res_mod <- callModule(
      module = selectizeGroupServer,
      id = "my-filters",
      data = mpg,
      vars = c("manufacturer", "model", "trans", "class"))
   
   output$table <- DT::renderDataTable(res_mod())
   
   # Bookmarking code --------------------------
   onBookmark(function(state) {
      state$values$filtered <- res_mod()
   })
   
   onRestore(function(state) {
      vals$sum <- state$values$filtered
   })
}

shinyApp(ui, server, enableBookmarking = "server")
thothal
  • 16,690
  • 3
  • 36
  • 71
samir
  • 17
  • 5

0 Answers0