My shiny version is 1.3.2
R version is 3.6,1
When I run renderDataTable {shiny} Examples, the code can't work
if (interactive()) {
# pass a callback function to DataTables using I()
shinyApp(
ui = fluidPage(
fluidRow(
column(12,
dataTableOutput('table')
)
)
),
server = function(input, output) {
output$table <- renderDataTable(iris,
options = list(
pageLength = 5,
initComplete = I("function(settings, json) {alert('Done.');}")
)
)
}
)
}
There is an open issue for this and a solution on its way, but if you are in a hurry you can solve this by replacing shiny::renderDataTable()
and shiny::dataTableOutput()
by the DT
versions DT::renderDataTable()
and DT::dataTableOutput()
opened 11:33PM - 05 Oct 19 UTC
closed 07:56PM - 11 Oct 19 UTC
<!--
This issue tracker is for bugs and feature requests in the Shiny package. … If you're having trouble with Shiny Server or a related package, please file an issue in the appropriate repository.
If you're having trouble with shinyapps.io, and you have a paid account (Starter, Basic, Standard, or Pro), please file a support ticket via https://support.rstudio.com. If you have a Free account, please post to the RStudio Community with the shinyappsio tag: https://community.rstudio.com/tags/shinyappsio.
Finally, if you are an RStudio customer and are having trouble with one of our Pro products, get in touch with our support team at support@rstudio.com.
Before you file an issue, please upgrade to the latest version of Shiny from CRAN and confirm that the problem persists.
# First, restart R.
# To install latest shiny from CRAN:
install.packages("shiny")
See our guide to writing good bug reports for further guidance: https://github.com/rstudio/shiny/wiki/Writing-Good-Bug-Reports. The better your report is, the likelier we are to be able to reproduce and ultimately solve it.
-->
### System details
Browser Version: Google Chrome Version 77.0.3865.90
Output of `sessionInfo()`:
```
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so
locale:
[1] LC_CTYPE=es_US.UTF-8 LC_NUMERIC=C LC_TIME=es_US.UTF-8
[4] LC_COLLATE=es_US.UTF-8 LC_MONETARY=es_US.UTF-8 LC_MESSAGES=es_US.UTF-8
[7] LC_PAPER=es_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=es_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shiny_1.3.2.9001
loaded via a namespace (and not attached):
[1] compiler_3.6.1 fastmap_1.0.0 magrittr_1.5 R6_2.4.0
[5] rsconnect_0.8.15 promises_1.1.0 later_1.0.0 htmltools_0.4.0.9000
[9] tools_3.6.1 Rcpp_1.0.2 jsonlite_1.6 digest_0.6.21
[13] xtable_1.8-4 httpuv_1.5.2.9000 mime_0.7 rlang_0.4.0
```
### Example application *or* steps to reproduce the problem
```R
library(shiny)
ui <- mainPanel(
dataTableOutput("table")
)
server <- function(input, output) {
output$table <- renderDataTable({
head(iris, 2)
})
}
shinyApp(ui = ui, server = server)
```
### Describe the problem in detail
`dataTableOutput()` produces this error message
![image](https://user-images.githubusercontent.com/14981085/66262021-dae78b00-e79d-11e9-971d-df2cd97458fb.png)
And then renders each character on the dataset as a cell
![image](https://user-images.githubusercontent.com/14981085/66262012-b4295480-e79d-11e9-9dae-4a087be311eb.png)
I have tried updating `shiny` and `DT` to the development versions but the issue persist, I have also updated shiny-server to the latest stable version.
2 Likes
Thanks, @andresrcs . I use DT::renderDataTable()
and have solved the problem now.
Hi, @andresrcs . Today I update shiny 1.3.2 to 1.4.0 and shiny::renderDataTable()
can work now. You might as well try it.
Check the GitHub issue, they said
we may likely be deprecating shiny::dataTableOutput()
and shiny::renderDataTable()
in a future version, so I'd suggest moving to the DT version
So I think is better to stick with DT
to anticipate any breaking changes.
system
Closed
October 18, 2019, 2:58am
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.