title: How to update numericInput default value based on DT row selected
body: <p>I'd like to update the numericInput value based on the different row users select from a DT table.</p>
  
  <p>Below is my simple example. So, if users select the 1st row, the value should be 50. If users select the 2nd row, the value should be 100. Is there a way to do it <strong>without</strong> using the 'refresh' button?</p>
  
  <pre><code>library(shiny)
  library(DT)
  
  
  ui &lt;- fluidPage(
      sidebarLayout(
          sidebarPanel(
              numericInput("price",
                          "Average price:",
                          min = 0,
                          max = 50,
                          value = 0),
  
              actionButton('btn', "Refresh")
          ),
  
          mainPanel(
              DT::dataTableOutput('out.tbl')
          )
      )
  )
  
  server &lt;- function(input, output, session) {
  
      price_selected &lt;- reactive({
          if (input$out.tbl_rows_selected == 1) { 
              price = 50
          } else {
              price = 100
          } 
      })
  
      observeEvent (input$btn, {
          shiny::updateNumericInput(session, "price",  value = price_selected())
      })
  
      output$out.tbl &lt;- renderDataTable({
          Level1 &lt;- c("Branded", "Non-branded")
          Level2 &lt;- c("A", "B")
          df &lt;- data.frame(Level1, Level2)
      })
  }
  
  shinyApp(ui = ui, server = server)
  </code></pre>