I have a Shiny app with a Bookmark button and a DT
table that allow the users to edit the contents (https://yuchenw.shinyapps.io/DT_Bookmark/). However, it seems like the Bookmark function cannot document the edited contents in the DT table.
Here is an example. I changed the car name in the first row to "Mazda RX4 aaaaa", and then I clicked "Bookmark button". It can generate an URL. But when I copied and pasted the URL to a new browser, it shows the original state of the app.
Is there a way to make the Bookmark function working? Here is the code.
library(shiny)
library(DT)
ui <- fluidPage(
titlePanel("Bookmark DT Example"),
sidebarLayout(
sidebarPanel(
bookmarkButton()
),
mainPanel(
DTOutput(outputId = "mDT")
)
)
)
server <- function(input, output){
rev <- reactiveValues(dat = mtcars)
output$mDT <- renderDT(
mtcars,
rownames = TRUE,
selection = "none",
editable = TRUE
)
dat_proxy <- dataTableProxy("mDT")
observeEvent(input$mDT_cell_edit, {
rev$dat <- editData(rev$dat, input$mDT_cell_edit, dat_proxy)
})
}
shinyApp(ui, server, enableBookmarking = "url")