-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use Shiny.bindAll
for a DT table?
#3979
Comments
Hi @stla and thanks for including a reprex with your issue! I've tried your example with shiny 1.7.1, 1.8.0, and the latest version from Can you clarify what you mean by "doesn't work anymore"? In my case, I noticed some unusual behavior with the select input not showing the B selection, but the server is correctly registering the choice indicating the the |
It works for you?? For me the observer executing |
Shoot, yeah, I do see this now trying again, sorry. I'm not sure why it looked like it was working before, maybe browser caching. I'll look into this. |
@stla after a bit of digging, I've discovered that the issue isn't about async binding but rather about using selectize in this scenario. If you set library(shiny)
ui <- fixedPage(
HTML(as.character(selectInput("id", label = NULL, choices = c("A", "B"))))
)
server <- function(input, output, session) {
observe(print(input$id))
}
shinyApp(ui, server) The issue is that the selectize dependencies are attached to the element returned by ui <- fluidPage(
br(),
DTOutput("dtable"),
shiny:::selectizeDependency()
) |
That behavior hasn't changed recently, so one possibility is that you used this pattern in an app that happened to have another |
Thanks! Alternatively, one can initialize the selectize input with this DT option:
but in order that it works, one needs to have a |
I've found a better way. No need to add a library(shiny)
library(DT)
library(htmltools)
select_input <- selectInput("id", label = NULL, choices = c("A", "B"))
deps <- htmlDependencies(select_input)
dat <- data.frame(
select = as.character(select_input)
)
ui <- fluidPage(
br(),
DTOutput("dtable"),
tagList(deps)
) |
Yeah, that general pattern is the way to go if you're coercing a shiny |
In order to use a Shiny widget in a DT table with shiny
< 1.8
, we used the following options:That doesn't work anymore. This is probably due to the breaking change in shiny
1.8.0
. I tried to play withasync/await
without success. What should we do?Here is an example:
The text was updated successfully, but these errors were encountered: