'R Shiny, shinjqui get orderInput after modification
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)
})
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|