I'm using reactable
to make a table in my shiny app. I added search bar to it but it only works for main rows of a table. In case I have expandable rows it doesn't work. I want to search values also in expandable rows. E.g. if you search for 'Front' word then rows which have it in nested/expandable rows should be filtered. Please have a look at my short and workable example:
if (interactive()) {
library(shiny)
library(reactable)
data <- MASS::Cars93[, 1:5]
dataDetails <- MASS::Cars93[, c(1,6,9,10)]
MASS::Cars93
ui <- fluidPage(
reactableOutput("table")
)
server <- function(input, output) {
output$table <- renderReactable({
reactable(
data,
searchable = TRUE,
selection = "multiple",
details = function(index){
extraData <- subset(dataDetails, data[[1]] == dataDetails[[1]][index])
htmltools::div(style = "padding: 16px",
reactable::reactable(extraData, outlined = TRUE))
}
)
})
}
shinyApp(ui, server)
}
I tried with js (expand rows automatically on keyup event in search bar, then search in expanded rows) but it didn't work for me and in fact it was very slow solution.