Does DT package provide multi-level row-grouping extensions?

,

Hi, I'am finding ways to make multi-level row-grouped table.

According to Datatables' documentation(https://datatables.net/extensions/rowgroup/examples/initialisation/multipleGroups.html), I tried multi-level row-grouping. But It didn't work

here is my example code

datatable(render_df,
          class = 'cell-border stripe',
          container =  container, 
          rownames = F, 
          extensions = 'RowGroup', 
          options = list(searching=FALSE,
                         lengthChange = FALSE,
                         info = F, 
                         ordering=F,
                         paging=F,
                         rowGroup = list(dataSrc=c(1,0)),
                         columnDefs = list(list(visible=FALSE, targets=c(0, 1)),
                                           list(className = 'dt-body-left',
                                                targets = seq(2)),
                                           list(className = 'dt-body-right',
                                                targets = seq(3:18)),
                                           list(width = '10%',
                                                targets = 2),
                                           list(width = col.width,
                                                targets = c(3:col.cnt))
                                           ),
                         pageLength = 20))

The result of this code is just 'No group'

Does anyone tried this multi-level row grouping before?

Kind regards.

2 Likes

I solved this problem myself fortunatly :slight_smile:

For someone who want to use this functionality, I share my solution.

I compared Datatables extentions between official service and R DT package. I found that R DT's RowGroup version is quite old, so I downloaded latest version of Rowgroup extensions (Download, only checked RowGroup) and changed RowGroup extension file in R/win-library/3.6/DT/htmlwidgets/lib/datatables (maybe this will be changed depending on your setting and OS. ) by downloaded file.

I didn't check any other possible error or bugs, but above code will work well.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.