rstudio / rstudio/flexdashboard

Flexdashboard is not allowing horizontal scrolling of DT

Open
#84 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
848
Forks
298
PR merge metrics
No merged PRs in 30d

Description

Hi,

I have a Flexdashboard that renders a DT::datatable that has a lot of columns. The trouble is, Flexdashboard does not seem to allow me to scroll this DT to the left or right. Only the first n columns are displayed on the screen, and the rest of the table is cut off. In addition, no pagination controls are visible at the bottom of the table, and the message at the bottom of the table that says "Showing 1 to 5 of 147 entries" is missing, even though I have both enabled for this DT.

I noticed that when I decrease the width of the browser window, these controls reappear and I am able to horizontally scroll. Why is it that I can't scroll horizontally when the window is wider?

These are my settings for the YAML:

output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: scroll

These are my settings for the only two content blocks:

knitr::opts_chunk$set(echo = TRUE)

Column {.tabset .tabset-fade data-width=10000 data-height=10000}

Title
#some beginning code...

And this is my DT:

DT:::datatable(tableName,
rownames=F,
escape = F,
extensions=c('Buttons','FixedHeader'),
autoHideNavigation = F,
fillContainer=T,
options=list(dom='fBrtip',
buttons=c('colvis','excel','csv'),
fixedHeader=T,
pageLength=5,
searchHighlight=T,
autoWidth=T,
columnDefs=list(list(width='100px',targets=c(0:58))),
scrollX=T)) #why can't I scroll horizontally?

Is there something that I am using incorrectly? When I recreate this same Rmd in the html_output layout, everything works correctly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the supplied R Markdown with flexdashboard::flex_dashboard and the DT::datatable options, first comparing it with html_output. Inspect the generated dashboard layout and DT container in browser developer tools; done means wide tables scroll horizontally and pagination/status controls remain visible.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.