EVOLUTION-MANAGER
Edit File: updateSelectInput.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Change the value of a select input on the client</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for updateSelectInput {shiny}"><tr><td>updateSelectInput {shiny}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Change the value of a select input on the client</h2> <h3>Description</h3> <p>Change the value of a select input on the client </p> <h3>Usage</h3> <pre> updateSelectInput( session, inputId, label = NULL, choices = NULL, selected = NULL ) updateSelectizeInput( session, inputId, label = NULL, choices = NULL, selected = NULL, options = list(), server = FALSE ) updateVarSelectInput( session, inputId, label = NULL, data = NULL, selected = NULL ) updateVarSelectizeInput( session, inputId, label = NULL, data = NULL, selected = NULL, options = list(), server = FALSE ) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>session</code></td> <td> <p>The <code>session</code> object passed to function given to <code>shinyServer</code>.</p> </td></tr> <tr valign="top"><td><code>inputId</code></td> <td> <p>The id of the input object.</p> </td></tr> <tr valign="top"><td><code>label</code></td> <td> <p>The label to set for the input object.</p> </td></tr> <tr valign="top"><td><code>choices</code></td> <td> <p>List of values to select from. If elements of the list are named, then that name — rather than the value — is displayed to the user. It's also possible to group related inputs by providing a named list whose elements are (either named or unnamed) lists, vectors, or factors. In this case, the outermost names will be used as the group labels (leveraging the <code style="white-space: pre;"><optgroup></code> HTML tag) for the elements in the respective sublist. See the example section for a small demo of this feature.</p> </td></tr> <tr valign="top"><td><code>selected</code></td> <td> <p>The initially selected value (or multiple values if <code>multiple = TRUE</code>). If not specified then defaults to the first value for single-select lists and no values for multiple select lists.</p> </td></tr> <tr valign="top"><td><code>options</code></td> <td> <p>A list of options. See the documentation of <span class="pkg">selectize.js</span> for possible options (character option values inside <code><a href="../../base/html/AsIs.html">base::I()</a></code> will be treated as literal JavaScript code; see <code><a href="renderDataTable.html">renderDataTable()</a></code> for details).</p> </td></tr> <tr valign="top"><td><code>server</code></td> <td> <p>whether to store <code>choices</code> on the server side, and load the select options dynamically on searching, instead of writing all <code>choices</code> into the page at once (i.e., only use the client-side version of <span class="pkg">selectize.js</span>)</p> </td></tr> <tr valign="top"><td><code>data</code></td> <td> <p>A data frame. Used to retrieve the column names as choices for a <code><a href="selectInput.html">selectInput()</a></code></p> </td></tr> </table> <h3>Details</h3> <p>The input updater functions send a message to the client, telling it to change the settings of an input object. The messages are collected and sent after all the observers (including outputs) have finished running. </p> <p>The syntax of these functions is similar to the functions that created the inputs in the first place. For example, <code><a href="numericInput.html">numericInput</a>()</code> and <code>updateNumericInput()</code> take a similar set of arguments. </p> <p>Any arguments with NULL values will be ignored; they will not result in any changes to the input object on the client. </p> <p>For <code><a href="radioButtons.html">radioButtons</a>()</code>, <code><a href="checkboxGroupInput.html">checkboxGroupInput</a>()</code> and <code><a href="selectInput.html">selectInput</a>()</code>, the set of choices can be cleared by using <code>choices=character(0)</code>. Similarly, for these inputs, the selected item can be cleared by using <code>selected=character(0)</code>. </p> <h3>See Also</h3> <p><code><a href="selectInput.html">selectInput()</a></code> <code><a href="varSelectInput.html">varSelectInput()</a></code> </p> <h3>Examples</h3> <pre> ## Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( p("The checkbox group controls the select input"), checkboxGroupInput("inCheckboxGroup", "Input checkbox", c("Item A", "Item B", "Item C")), selectInput("inSelect", "Select input", c("Item A", "Item B", "Item C")) ) server <- function(input, output, session) { observe({ x <- input$inCheckboxGroup # Can use character(0) to remove all choices if (is.null(x)) x <- character(0) # Can also set the label and select items updateSelectInput(session, "inSelect", label = paste("Select input label", length(x)), choices = x, selected = tail(x, 1) ) }) } shinyApp(ui, server) } </pre> <hr /><div style="text-align: center;">[Package <em>shiny</em> version 1.5.0 <a href="00Index.html">Index</a>]</div> </body></html>