Datatable rendering outside box in Shiny Dashboard

2,347 views
Skip to first unread message

Iain Wallace

unread,
Sep 16, 2015, 9:15:52 AM9/16/15
to Shiny - Web Framework for R
Hi all,

I don't have a reproducible example at the moment, but I was wondering if anybody else had seen this behavior before?

I have a simple Shiny Dashboard page that displays one datatable and if I change the number of rows displayed from 10 to 100 the datatable will display outside of the box.

Occasionally, I have seen this in other more complicated apps that I am developing where a datatable is populated based on a selection on a different table.

Thanks

Iain

Yihui Xie

unread,
Sep 16, 2015, 2:27:04 PM9/16/15
to Iain Wallace, Shiny - Web Framework for R
You can probably use the scrollY option to restrict the height of the
table: http://datatables.net/reference/option/scrollY e.g.
DT::datatable(..., options = list(scrollY = '300px'))

Regards,
Yihui

Iain Wallace

unread,
Sep 16, 2015, 3:10:08 PM9/16/15
to Yihui Xie, Shiny - Web Framework for R
Thanks Yihui.

The ScrollY option does fix  the issue but it actually causes an issue with the column filters. This might be related to this issue https://github.com/rstudio/DT/issues/41

Interesting, this issue does not happen when I don't use the shiny dashboard and instead use the default shiny page. This box issue might be related to this issue https://github.com/rstudio/shinydashboard/issues/67

Thanks again,

Iain

Yihui Xie

unread,
Sep 16, 2015, 4:12:39 PM9/16/15
to Iain Wallace, Shiny - Web Framework for R
Oh, that is right. Perhaps you can wrap the table in a div(..., style
= "overflow-y: auto; height: 300px") like I said in the issue #41.

Regards,
Yihui

Iain Wallace

unread,
Sep 16, 2015, 4:24:59 PM9/16/15
to Yihui Xie, Shiny - Web Framework for R
Thanks!

Wrapping it in the div works perfectly
Reply all
Reply to author
Forward
0 new messages