Make DT (DataTable) responsive using flexdashboard with Shiny in R

Viewed 957

The following example (file ex.Rmd) results in a horizontal scrollbar when the window width is small. Any way to make the table fully responsive, i.e. remove the horizontal scroll and add the columns under the collapsed information?

    ---
    title: "Untitled"
    output: 
      flexdashboard::flex_dashboard:
        orientation: rows
        vertical_layout: fill
    runtime: shiny
    editor_options: 
      chunk_output_type: console
    ---

    ```{r setup, include=FALSE}
    library(flexdashboard)
    library(DT)
    ```

    Menu
    =======================================================================

    Row
    -----------------------------------------------------------------------

    ### Testing  

    ```{r}
    renderDT(head(mtcars), extensions = c('Responsive'))
    ```

Result of small window

1 Answers

What about

renderDT({
  datatable(head(mtcars), extensions = c('Responsive'), 
            options = list(responsive = TRUE))
})
Related