0

I have an orderInput from the shinyjqui library and I would like the server to set which items are in the orderInput. Afterwards I would like the user to modify this orderInput and I would like to observe this modification on the server side. The new orderInput items which the server is supposed to put into the orderInput are not known at the time of writing the code. That this does not work is documented in the documentation of the updateOrderInput function. Is there any workaround or way I could implement this?

The following code illustrates further what I would like to do:

library(shiny)
library(shinyjqui)

ui <- fluidPage(
 actionButton("update", label = "update"),
 orderInput("ordering", label = NULL, items = c("1","2"))
)

server <- function(input, output, session) {
 observeEvent(input$update, {
  updateOrderInput(session, "ordering", items = c("1", "2", "3"))
 })
 observeEvent(input$ordering, {
  # if the user changes it, retrieve the information
  print(input$ordering)
 })
}
Adriaan
  • 17,741
  • 7
  • 42
  • 75
L. t.
  • 107
  • 3
  • 1
    It's unclear to me what you're trying to accomplish as your code seems to do what you describe. The only limitation I see in the documentation is when you have multiple `orderInput`s and are moving items between them. Is that what you're trying to do? – Marcus May 13 '22 at 18:00
  • It does not do what I describe because the orderInput does not report back into input$ordering what the user changed after calling updateOrderInput. I found a solution however: using and uiOutput instead to initialize a completely new orderInput with renderUI. – L. t. May 14 '22 at 16:19

0 Answers0