Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFeature Request: replaceData #49
Comments
|
Hi, Yup this is possible, and something I started working on a while back. It'll be added through something like |
|
It sounds great! Ideally, I would like to make a proxy table with other nested proxy tables inside. Unfortunately it doesn't seem possible with DT, maybe it will be possible with reactable in the future? |
|
Added a The And here's another toy app that simulates real-time data updates: https://github.com/glin/reactable/blob/master/inst/examples/shiny-data-streaming.R |
|
Nested proxy tables should already be supported, but it's definitely not well tested. You may stumble upon some bugs :). To use reactable(
details = function(index) {
reactableOutput("nested_table")
}
)Here's an example app that uses library(shiny)
library(reactable)
data <- MASS::Cars93[, 1:7]
ui <- fluidPage(
selectInput("filter_type", "Filter type", unique(data$Type), multiple = TRUE),
reactableOutput("table")
)
server <- function(input, output) {
output$table <- renderReactable({
reactable(
data,
defaultExpanded = TRUE,
details = function(index) {
if (index == 2) {
reactableOutput("nested_table")
}
}
)
})
output$nested_table <- renderReactable({
reactable(data, selection = "multiple", bordered = TRUE)
})
observeEvent(input$filter_type, {
if (length(input$filter_type) > 0) {
filtered <- data[data$Type %in% input$filter_type, ]
} else {
filtered <- data
}
updateReactable("nested_table", data = filtered)
}, ignoreNULL = FALSE)
}
shinyApp(ui, server) |
|
This is awesome! |
It's possible to update and not reset expansion? |
Hi, first of all a great package! Thank you for your time and effort!
Is it possible to make a function like replaceData in DT?
https://rdrr.io/cran/DT/man/replaceData.html
I'd like to update my table without regenerating it every time I change the inputs.