Coder Social home page Coder Social logo

Comments (2)

Arthfael avatar Arthfael commented on May 28, 2024

Clearly I had not diagnosed the problem well: this is a problem of how selectInput interacts not with sapply,
but with DT:

# Testing interaction with sapply without table:
Values <- list(Test_1 = NA, Test_2 = NA)
ui <- fluidPage(
  titlePanel(tag("u", "Test"), "Test"),
  h3("Is just sapply working?"),
  selectInput("Test_1", "", as.character(1:5), "1", width = "100px"),
  selectInput("Test_2", "", as.character(1:5), "1", width = "100px"),
  actionButton("saveBtn", "Save"),
  br(),
)
server <- function(input, output, session) {
  sapply(1:2, function(x) {
    id <- paste0("Test_", x)
    observeEvent(input[[id]], {
      cat(input[[id]], "\n")
      Values[[id]] <<- input[[id]]
    }, ignoreNULL = FALSE)
  })
  observeEvent(input$saveBtn, { stopApp() })
  session$onSessionEnded(function() { stopApp() })
}
print(shinyApp(ui, server))
Values
# -> This works.

As a consequence, I have renamed the thread.

from shiny.

stla avatar stla commented on May 28, 2024

See #3979
There are two options: either you set selectize=FALSE in selectInput. Or if you want to use selectize, you have to get and include the HTML dependency and to initialise the select inputs - see the above linked issue.

from shiny.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.