DT::DataTable how to combine extension?

850 views
Skip to first unread message

Enzo

unread,
Mar 5, 2015, 7:43:16 PM3/5/15
to shiny-...@googlegroups.com
I'm going through the various options and extensions to this great package as described here: http://rstudio.github.io/DT/

Is it possible to combine extensions?

I would like to have "Scroller" and "FixedColumns" (I assume this being a typical option for large amount of data).  Is it possible?

How?

They seem to have different DOM specifications, and clearly my experiments so far have been unsuccessful.

Yihui Xie

unread,
Mar 5, 2015, 9:45:14 PM3/5/15
to Enzo, shiny-discuss
Yes, it is possible to combine extensions, as the DT website has
clearly indicated in beginning of the page:
http://rstudio.github.io/DT/extensions.html. In theory, this is what
you want to do:

m = as.data.frame(round(matrix(rnorm(10000), 100), 5))
m = cbind(ID = seq_len(nrow(m)), m)
library(DT)
datatable(m, extensions = c('Scroller', 'FixedColumns'), options = list(
deferRender = TRUE,
dom = "frtiS",
scrollY = 200,
scrollCollapse = TRUE
))

However, I think there is a conflict (or bug) between Scroller and
FixedColumns. In the above example, only the table header ID is fixed,
and the cells in the ID column are not. I think you need to ask the
DataTables developers to fix it.

Regards,
Yihui

Enzo

unread,
Mar 6, 2015, 7:29:54 AM3/6/15
to shiny-...@googlegroups.com, emart...@gmail.com

I reported the issue to the data tables forum as you suggested.

In doing so I had to create a test case with http://debug.datatables.net/ecurim  (fantastic and simple tool by the way!).

If you click on plug-ins in the tool above it shows that there is only one plug-in, the Scroller one.

The FixedColumn plug-in is missing.  

Are you really sure that the DT table code is doing the right thing?

Thanks

Yihui Xie

unread,
Mar 6, 2015, 10:21:16 AM3/6/15
to Enzo, shiny-discuss
Yes, I'm sure. See http://i.imgur.com/Sp2e2YX.gif As I said, you can
see the column header "ID" is fixed, but the cells of this column are
not.

Regards,
Yihui

Enzo

unread,
Mar 6, 2015, 12:31:28 PM3/6/15
to shiny-...@googlegroups.com, emart...@gmail.com
Thanks Yihui.  I've just got a reply from Allan at data tables.net:

"Currently these two are not compatible. It is a feature that I hope to add in future.
Allan"
I guess if other people will request this it may bump up on the priority list...

Thanks
Reply all
Reply to author
Forward
Message has been deleted
0 new messages