Skip to content

groupname_col disappears with opt_interactive() #1705

@olivroy

Description

@olivroy

With gt 0.10.0.9000,

we can have

d <- mtcars |> dplyr::slice_head(n = 10)
row_group_as_columns = FALSE row_group_as_columns = TRUE
gt::gt(d, groupname_col = "vs") gt::gt(d, groupname_col = "vs", row_groups_as_columns = TRUE)
image image

Currently, opt_interactive() hides the vs groupname_col column regardless.

Here is my suggestion with reactable::reactable()

# use `colDef()` to hide column name
# use rownames = FALSE since we are using a different column as row names
# From https://github.com/glin/reactable/issues/94
grp_fn  = reactable::JS("
      function(cellInfo) {
        return cellInfo.value
      }")

mtcars |> dplyr::slice(1:10)  |>reactable::reactable(groupBy = "vs",defaultExpanded = T, rownames = FALSE, columns = list(vs = reactable::colDef(name = "", grouped = grp_fn)))

image

I don't see a good solution for row_group_as_columns = T as I couldn't find an example of reactable merging a column, but would still be an improvement.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions