updateOrderInput: Change the value of an orderInput on the client

Description Usage Arguments Examples

Description

Similar to the input updater functions of shiny package, this function send a message to the client, telling it to change the settings of an orderInput object. Any arguments with NULL values will be ignored; they will not result in any changes to the input object on the client. The function can't update the "source" orderInputs.

Usage

1
2
3
4
5
6
7
8
updateOrderInput(
  session,
  inputId,
  label = NULL,
  items = NULL,
  connect = NULL,
  item_class = NULL
)

Arguments

session

The session object passed to function given to shinyServer.

inputId

The input slot that will be used to access the current order of items.

label

Display label for the control, or NULL for no label.

items

Items to display, can be a list, an atomic vector or a factor. For list or atomic vector, if named, the names are displayed and the order is given in values. For factor, values are displayed and the order is given in levels

connect

Optional. Allow items to be dragged between orderInputs. Should be a vector of inputId(s) of other orderInput(s) that the items from this orderInput should be connected to.

item_class

One of the Bootstrap color utility classes to apply to each item.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
library(shiny)

if (interactive()) {

  ui <- fluidPage(
    orderInput("foo", "foo",
               items = month.abb[1:3],
               item_class = 'info'),
    verbatimTextOutput("order"),
    actionButton("update", "update")
  )

  server <- function(input, output, session) {
    output$order <- renderPrint({input$foo})
    observeEvent(input$update, {
      updateOrderInput(session, "foo",
                       items = month.abb[1:6],
                       item_class = "success")
    })
  }

  shinyApp(ui, server)

}

shinyjqui documentation built on Feb. 3, 2022, 9:06 a.m.