rstudio / flexdashboard

Easy interactive dashboards for R
https://pkgs.rstudio.com/flexdashboard/
Other
812 stars 301 forks source link

Vertical Scrolling for Datatable object in Container #83

Open LucianoSP opened 8 years ago

LucianoSP commented 8 years ago

I have a dashboard with several pages. In every page, there is a container with a DataTable in it. The problem is that I can´t scroll the table down, so it only shows a few lines of the table. Is this a bug or there is a way to enable vertical scrolling within the container for the datatable object?

mwillumz commented 8 years ago

This seems to be a bug (happened to me too). However, I couldn't reproduce a minimal example. In fact, after reloading project and rekniting I had a full table.

???

LucianoSP commented 8 years ago

Ok. Maybe it's the layout I'm using. I will try to replicate an example and will post it here.

Em Seg, 15 de ago de 2016 19:28, mwillumz notifications@github.com escreveu:

This seems to be a bug (happened to me too). However, I couldn't reproduce a minimal example. In fact, after reloading project and rekniting I had a full table.

???

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rstudio/flexdashboard/issues/83#issuecomment-239948733, or mute the thread https://github.com/notifications/unsubscribe-auth/AKb0YZKMPBHIbYWvrWNw6mI7jsvSLXCLks5qgOgcgaJpZM4Jk0cq .

LucianoSP commented 8 years ago

Here it is. This is what Im using. The 2 datatables containers don´t scroll vertically.

`--- title: "Painel Demonstrativo" output: flexdashboard::flex_dashboard:

runtime: shiny

library(flexdashboard)
library(dplyr)
library(dygraphs)
library(DT)
library(ggplot2)
library(XML)
library(RCurl)

noticia = function(url) {
  invalidateLater(120000)
  url<-url 
  rssdoc<- xmlParse(getURL(url, .encoding = "ISO-8859-2")) 
  rsstitle <- xpathSApply(rssdoc, '//item/title', xmlValue) 
  rsslink <- xpathSApply(rssdoc, '//item/link', xmlValue)
  rssdata <- xpathSApply(rssdoc, '//item/pubDate', xmlValue)
  df2 = data.frame(rsstitle, rsslink, rssdata)
  df2$url = paste("<a href=\'", df2$rsslink, "\'>" ,rsstitle, "</a>", sep = "")
  datatable(df2 %>% select(rssdata, url), rownames = FALSE, 
            colnames = c('Data', 'Notícia'),
            options = list(autoWidth = FALSE, dom = 't', pageLength = 30), 
            escape = FALSE) 
}

Bolsas {data-orientation=rows}

Inputs {.sidebar}


selectInput("bolsa", label = "Escolha a Bolsa:",
            choices = c("test1", "test2"), selected = "test1")

tags$h2("Data Inicial")
dateRangeInput("databolsa", "Intervalo:",
               start  = as.character(Sys.Date() - 365 * 3),
               end    = as.character(Sys.Date()),
               min    = "2013-01-01",
               max    = as.character(Sys.Date()),
               format = "dd/mm/yy",
               separator = " a ")

Row {data-height=300}

Tabela dos valores médios, mínimos e máximos dos diversos tickers

renderDataTable({datatable(mtcars)})

Row {data-height=400}

Série Histórica

renderDygraph({
   lungDeaths <- cbind(mdeaths, fdeaths)
    dygraph(lungDeaths)
})

Row {data-height=400}

Intraday

renderDygraph({
    lungDeaths <- cbind(mdeaths, fdeaths)
    dygraph(lungDeaths)
})

Notícias

DT::renderDataTable({
  noticia("http://www.valor.com.br/brasil/macroeconomia/rss")
})

`

LucianoSP commented 8 years ago

image

LucianoSP commented 8 years ago

Ok, I just tried updating the DT package from Github and now it doesn´t render anything. Its all blank.

` sessionInfo() R version 3.3.1 (2016-06-21) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian GNU/Linux stretch/sid

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] RCurl_1.95-4.8 bitops_1.0-6 XML_3.98-1.4 ggplot2_2.1.0.9000 DT_0.2.2 flexdashboard_0.3 feedeR_0.0.4
[8] dygraphs_0.9 xts_0.9-7 zoo_1.7-13 readr_1.0.0 dplyr_0.5.0.9000

loaded via a namespace (and not attached): [1] Rcpp_0.12.6 plyr_1.8.4 git2r_0.15.0 tools_3.3.1 digest_0.6.10 lubridate_1.5.6 jsonlite_1.0
[8] evaluate_0.9 memoise_1.0.0 tibble_1.1 gtable_0.2.0 lattice_0.20-33 DBI_0.5 curl_1.2
[15] yaml_2.1.13 withr_1.0.2 stringr_1.0.0 httr_1.2.1.9000 knitr_1.14 htmlwidgets_0.7 devtools_1.12.0 [22] grid_3.3.1 R6_2.1.2 rmarkdown_1.0 magrittr_1.5 scales_0.4.0 htmltools_0.3.5 assertthat_0.1
[29] colorspace_1.2-6 stringi_1.1.1 munsell_0.4.3 `

image

LucianoSP commented 8 years ago

Ok, sorry. I found a mistype in my code. I replaced the flexdashboard::flex_dashboard: with flexdashboard::flex_dashboard and everything is showing again. I´ve updated DT from github (0.2.2) and dygraphs(1.1.1-1) and is fine. The only problem remaining is the vertical scrolling now showing in DT container.

jeffreyhorner commented 7 years ago

There is indeed something strange going on.

I don't have a reproducible example but it appears that DT doesn't mesh well with flexdashboard...

Also the default css overflow for chart-* is hidden, which causes DT's to be chopped if they're larger than their chart div.

CollierKing commented 7 years ago

Vertical and horizontal scrolling works for me in Flexdashboard with this:

renderDataTable({

selectedData2()

}, options = list( scrollY = '300px', paging = FALSE, scrollX = TRUE) )

tarunparmar commented 6 years ago

scrollX and scrollY dont take boolean value.

Check my response here: issue 109

Kvit commented 6 years ago

I found the following solution: Dashboard settings (YAML):

---
output:
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
---

DT options:

# set common data table options
options(DT.options = list(scrollY="100vh"))

This way DT fills full container in Dashboard but starts vertical scroll if goes beyond 100%(v)iew(h)eight of container