How to refer to reactive element in ui.R in Shiny

后端 未结 2 1858
独厮守ぢ
独厮守ぢ 2021-01-25 13:33

I am making an app with drag and drop feature using the ShinyDND package. I would like to pass a list from input as a parameter of dragSetUI, a function that needs to be run in

2条回答
  •  不要未来只要你来
    2021-01-25 14:05

    Comment by @ismirsehregal helped me find the solution: shinyjqui can be used for my purposes and it seems to work from inside renderUI. Here is the edited code that does exactly what I needed.

    library(shiny)
    library(shinyjqui)
    
    
    ui <- fluidPage(
      textInput("choices","Put here a,b,c:"),
      uiOutput("reactiveselect"),
      orderInput(inputId = 'drop', label = 'Reactive drop', items = NULL,placeholder = "drop here..."),
      verbatimTextOutput("droppedorder")
    )
    
    
    server <- function(input, output) {
    
    
    
      output$reactiveselect <- renderUI({
        req(input$choices)
        reactiveitems<- unlist(strsplit(input$choices,","))
        orderInput("groupstochoose", "groups to choose from:", connect='drop',items=reactiveitems)
    
      })
    
      output$droppedorder<-
        renderPrint({input$drop_order})
    
    }
    
    
    
    shinyApp(ui, server)
    

提交回复
热议问题