CheckboxRows in DT shiny not working

425 views
Skip to first unread message

sharon ravindran

unread,
Jun 29, 2015, 10:55:27 AM6/29/15
to shiny-...@googlegroups.com
I recently updated my R version within R studio, and now my shiny application that was making use of the DT package, where I was adding checkboxRows in the rownames field, doesn't work. I get the error of ""Error: could not find function checkboxRow". Any suggestions on what the bug might be? It was working perfectly fine before the update. The code I am using : 


            datatable(theResult, extensions='KeyTable',rownames =  checkboxRows(theResult, checked=theSelIndexes),
                      options = list(deferRender = TRUE,
                             paging = FALSE,
                             searching = FALSE,
                             autoWidth = TRUE,
                             scrollX = TRUE,
                             scrollY = 600,
                             scrollCollapse = TRUE,
                             order = list(list(2, 'desc'))
                            ),
                      escape = -1
            ) 

Yihui Xie

unread,
Jun 29, 2015, 2:10:56 PM6/29/15
to sharon ravindran, shiny-discuss
Row selection is enabled by default now in DT, and the checkboxRows()
function has been removed. Please see
http://rstudio.github.io/DT/shiny.html and
https://github.com/rstudio/DT/issues/93

Regards,
Yihui

sharon ravindran

unread,
Jun 29, 2015, 3:23:35 PM6/29/15
to shiny-...@googlegroups.com, sharonrav...@gmail.com
Thank you for the reply. However, how would I change which rows are selected on the server side? I want to initialize the table to already have rows selected right at the moment I display the table?

Thank you
Cheers

Yihui Xie

unread,
Jun 29, 2015, 4:52:48 PM6/29/15
to sharon ravindran, shiny-discuss
That is a feature I added to the development version a while ago (i.e.
devtools::install_github('rstudio/DT')). Basically what you can do is
something like

renderDataTable({
datatable(data, selection = list(selected = rownames(data)[c(1, 2, 4, 5, 9)]))
})

Please see `selection` in the documentation ?datatable.

Regards,
Yihui
> --
> You received this message because you are subscribed to the Google Groups
> "Shiny - Web Framework for R" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to shiny-discus...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/shiny-discuss/a2e2bc97-02f3-46af-b7f5-924c266419d1%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages