title: R shiny - save chosen values in selectInput
body: <p>I have 10 'Edit' actionButtons. On each 'Edit' action buttons appears three selectInputs. After I click on 'Save' button below selectInputs, I want to remember selected values. If i go to row 2 -> click 'Edit' -> select values -> click 'Save' and go back to row 1, it does not remember previously selected values in row 1.</p>
  
  <p>So I want to have two actions on 'Save' button namely:</p>
  
  <ul>
  <li>store selected values for given 'Row' (so when i click again on the same Edit button I will see previously selected values)</li>
  <li><p>make all selectInputs disapear after i click on save button</p>
  
  <p>library(shiny)</p>
  
  <pre><code>ui &lt;- shinyUI(fluidPage(
  
     titlePanel("Update Select Inputs"),
  
        mainPanel(
          tags$head(tags$script(HTML("$(document).on('click', '.needed', function () {
                               Shiny.onInputChange('last_btn',this.id);
                                     });"))),
          column(width = 6,
           uiOutput('ValuesAndButtons')),
           column(width = 6,uiOutput('Details'))
        )
     )
  )
  
  server &lt;- shinyServer(function(input, output) {
  
    output$ValuesAndButtons &lt;- renderUI({
  
        lapply(
          c(1:10),
          function(i){
            fluidRow(
              column(
                width = 4,
                tags$span(i)
              ),
              column(
                width = 3,
                tags$button(
                  type = "button",
                  id = paste0('ActionButton', i),
                  class="btn action-button needed",
                  "Edit"
                )
              )
            )
          }
        )
    })
  
    output$Details &lt;- renderUI ({
  
      req(input$last_btn)
  
      fluidRow(
        lapply(
          c(1:3),
          function(i){
            fluidRow(
              fluidRow(
                column(
                  width = 5,
                  tags$span(i)
                ),
  
                column(
                  width = 5,
                  selectInput(
                    paste0("Details", i), 
                    label = NULL, 
                    choices = c("","a","b","c"),
                    selected = ""
  
                  )
                )
              )
            )
  
          }),
        fluidRow(
          tags$button(
            type = "button",
            id = "Save",
            class = "btn action-button",
            href = "#",
            "Save"
          )
        )
      )
    })
  
  })
  
  # Run the application 
  shinyApp(ui = ui, server = server)
  </code></pre></li>
  </ul>