rstudio / rstudio/flexdashboard
DT::renderDataTable Example Broken
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 848
- Forks
- 298
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I had some code working on macOS which then broke when I switched to windows. I isolated it to DT::renderDataTable.
The exact example on the documentation website that's broken is here: (http://rmarkdown.rstudio.com/flexdashboard/using.html), specifically this snippet:
### Cars
```{r}
DT::renderDataTable({
data <- head(mtcars, n = input$maxrows)
DT::datatable(data, options = list(
bPaginate = FALSE
))
})
Here is a reproducible minimal example showing DT::renderDataTable not working where
shiny::renderDataTable and shiny::renderTable both still work.
---
title: "Bug Report"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
runtime: shiny
---
```{r setup, include=FALSE}
library(flexdashboard)
data(mtcars)
```
Column {.sidebar}
---------------------------------------------------------------------
```{r}
shiny::sliderInput("maxrows", "max rows", 1, 40, 10, 1)
```
Column
-----------------------------------------------------------------------
```{r}
mtcars2 <- reactive({head(mtcars, n = input$maxrows)})
```
```{r}
DT::renderDataTable({
DT::datatable(mtcars2(), options = list(
bPaginate = FALSE
))
})
```
Column
-----------------------------------------------------------------------
```{r}
shiny::renderDataTable({mtcars2()})
```
```{r}
shiny::renderTable({mtcars2()})
```
After running this document, the reactive elements are not drawn.

However, if I create at DT::datatable outside a reactive context first, then all the datatable created in the reactive context draws.
So adding in this chunk
### Not-reactive DT::Datatable
```{r}
DT::datatable(mtcars, options = list(
pageLength = 25
))
```
yeilds this

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied minimal flexdashboard document and compare DT::renderDataTable with the working shiny renderers, including the non-reactive DT::datatable case. Done means the reactive DT table renders correctly on Windows and the documentation example at using.html works as shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100