9

I am designing a UI using Flexdashboard and some of the textinput boxes are going beyond the regular browser window, I have added a line vertical_layout: scroll in my code but I am guessing that is not enough ? So my question is how do I enable vertical scrolling feature as shown in this image below. ? Any tips or pointers are much appreciated.

enter image description here

Here's my code below

---
title: "Untitled"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: scroll
    smooth_scroll: true
    runtime: shiny
---

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

     Inputs {.sidebar}
-----------------------------------------------------------------------

  ```{r}
library(shiny)
library(shinyjs)


shinyjs::useShinyjs()
#tags$hr(),
shinyjs::disabled(textInput("id", "Id", "0"))
textInput("X1", "X1", "")
textInput("X2", "X2", "")
textInput("X3", "X3", "")
textInput("X4", "X4", "")
textInput("X5", "X5", "")
textInput("X6", "X6", "")
textInput("X7", "X7", "")
textInput("X8", "X8", "")
textInput("X9", "X9", "")
textInput("X10", "X10", "")
textInput("X11", "X11", "")
textInput("X12", "X12", "")

textInput("X13", "X13", "")
textInput("X14", "X14", "")
textInput("X15", "X15", "")
textInput("X16", "X16", "")

checkboxInput("X17", "X17", FALSE)


#action buttons
actionButton("submit", "Submit Changes")


```

2 Answers2

13

This issue has been resolved here: https://github.com/rstudio/flexdashboard/issues/27

You can use a version with the fix by installing the latest version from GitHub:

devtools::install_github("rstudio/flexdashboard")

Alternatively, you could add this snippet of CSS to your dashboard:

<style type="text/css"> .sidebar { overflow: auto; } </style>
nacnudus
  • 6,328
  • 5
  • 33
  • 47
JJ Allaire
  • 556
  • 3
  • 3
0

I had this problem recently but tried the CSS solution above and it did not work. I was displaying my data in a DT datatable, so I found this solution with scrollX and scrollY that works well across current Chrome, Firefox and IE:

library(DT)

DT::renderDataTable({
datatable(display.data(), style='bootstrap',
  class='table-condensed', 
  editable=TRUE, rownames=FALSE, extensions = 'Buttons',
  options = list(
    scrollX = '400px', scrollY='360px',
    searchHighlight = TRUE,
    columnDefs = list(list(width='50px',targets=c(0:9))),
    order=list(0, 'asc'),
    pageLength=10
)
)
mysteRious
  • 4,102
  • 2
  • 16
  • 36