reactable icon indicating copy to clipboard operation
reactable copied to clipboard

Expand rows by any column, not all

Open bikeactuary opened this issue 3 years ago • 2 comments

cross-posting for visibility

I want to see column "val" according to colA and time, without expanding/seeing values of colB (value is summed over the categories within this column). But also leaving colB in the table for user to optionally expand for the finer detail. Is this possible?

dat <- data.frame(colA = c(rep("Yes", 20,), rep("No", 20)),
                  colB = rep(c(letters[1:5]), 4)) %>%
  arrange(colA, colB) %>%
  mutate(time = rep(1:4, 10),
         val = runif(40))

reactable(dat,
  groupBy = c("colA", "colB"),
  columns = list(
    val = colDef(aggregate = "sum")
  ),
  bordered = TRUE)

bikeactuary avatar Feb 20 '23 23:02 bikeactuary

Coincidentally, I just answered pretty much the same question in a different issue! Copying my response from https://github.com/glin/reactable/issues/268#issuecomment-1421300337:

expansion is either all or nothing right now due to prior technical limitations. I've never thought of limiting expansion to certain columns (or I guess nesting level) though, and I think that's a really great idea.

So this isn't possible right now, but I'll tag it as a feature request to look at whenever I revisit default row expansion.

glin avatar Feb 21 '23 00:02 glin

Thx - subscribing

bikeactuary avatar Feb 21 '23 00:02 bikeactuary