ui <- dashboardPage( dashboardHeader(), dashboardSidebar( sidebarMenu( menuItem( text = "Filter Tab", tabName = "tab1" ), menuItem( text = "Table Tab", tabName = "tab2" ) ) ), dashboardBody( tabItems( tabItem( tabName = "tab1", absolutePanel(top = 80, right = 530, width = 200, module1UI("filter1")), absolutePanel(top = 80, right = 300, width = 200, module1UI("filter2")), absolutePanel(top = 80, right = 70, width = 200, module1UI("filter3")), ), tabItem( tabName = "tab2", fluidPage( fluidRow( module2UI("table") ) ) ) ) ))server <- function(input, output){ data1 <- callModule(module1, "filter1") data2 <- callModule(module1, "filter2") data3 <- callModule(module1, "filter3") callModule(module2, "table")}module1UI <- function(id){ ns <- NS(id) tagList(wellPanel(selectInput(ns("filterTask"), "Filters", choices = "<some filter choices>")))}
module1 <- function(input, output, session, dataSet){ filterExp <- reactive({ switch(input$filterTask, ...) }) filteredData <- reactive({ get(dataSet) %>% filterExp()}) return(filteredData)}module2UI <- function(id){ ns <- NS(id) tagList(fluidRow( column(width = 3, selectInput(ns("dataSel"), "Select a dataset", choices = "<some dataset choices>")), column(width = 9, dataTableOutput(ns("table"))) ))}
module2 <- function(input, output, session){ # here I would like to get a list of 3 datasets, in this case list(data1, data2, data3),
# so that I can use that to update the choices for the select input # let's get the names of the datasets from the list named dataList choices <- reactive({ names(dataList())}) observe({ updateSelectInput(session, "dataSel", choices = choices()) }) # now using the selected dataset, I would like to get the data of that dataset getData <- reactive({dataList()[[input$dataSel]]}) output$table <- renderDataTable({getData()})}env <- environment() varList <- ls(env)--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/6e95c6e1-0626-479c-a448-d02e7a38277b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/0bfce9dd-9463-4719-8cf4-58f0e7b985cb%40googlegroups.com.