Hello!
I'd like to have an editable table which would allow the user to filter for certain values and edit them without resetting the filtering context. Somehow both: search and filtering do not work (the table "unfilters") and I already tried all different options in shiny/ DT and wasn't able to find any reference online for that.
I assume the problem must be somehow related to the reactivity of my solution but can't nail it down. Has anyone come across a similar issue and was able to overcome?
A small example below:
library(shiny)
library(DT)
library(tidyverse)
options(shiny.reactlog = TRUE)
shinyApp(
ui = fluidPage(
actionButton(
inputId = "go",
label = "Update"
),
DTOutput('x1')
),
server = function(input, output, session) {
evt_go_iris <- eventReactive(input$go, {
x = iris
x$Date = Sys.time() + seq_len(nrow(x))
x <- as.data.frame(x) %>%
slice(1:20)
})
rec_val = reactiveValues(df = NULL)
observe({
rec_val$iris <- evt_go_iris()
})
output$x1 = DT::renderDataTable({datatable(rec_val$iris, rownames = FALSE, editable = TRUE, filter = "top")})
proxy = DT::dataTableProxy("x1")
observeEvent(input$x1_cell_edit, {
info = input$x1_cell_edit
rec_val$iris <<- editData(rec_val$iris, info, "proxy", rownames = FALSE, resetPaging = FALSE)
})
}
)