I am trying to reuse this datable example of child/parent rows in a shiny app that I am building:
https://rstudio.github.io/DT/002-rowdetails.html
There's also a slight modification that allows adding multiple rows:
https://github.com/rstudio/DT/issues/393#issuecomment-279627237
However, my case is a bit different. I have a dataframe with a main grouping parent variable and child rows. Child rows can be anything from 0 to n. I want to show my parent variable once and all it's children hidden beneath it.
Here's some sample data:
library(dplyr)
df = data.frame() %>%
rbind(c("parent1", "childA", "desc1")) %>%
rbind(c("parent1", "childB", "desc2")) %>%
rbind(c("parent2", "childC", "desc3")) %>%
rbind(c("parent3", "childD", "desc4")) %>%
rbind(c("parent4", "childE", "desc5")) %>%
rbind(c("parent4", "childF", "desc6")) %>%
rbind(c("parent4", "childG", "desc7")) %>%
`colnames<-`(c("parentID", "childID", "childDesc"))
Caveat: I don't know javascript and I have no idea how to adapt such code. I've seen multiple examples attempting to address the same issue, however, there is so much code and customization to them. I was hoping the simpler example above is easier to modify and someone can walk me through it. I also don't need any fancy formatting. Here are some examples I've seen:
Parent/Child Rows in Shiny R with a single dataframe that has a variable number of rows
Parent/Child Rows in R shiny Package
Parent/Child Rows in Shiny R with a single dataframe that has a variable number of rows