Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dataEditServer - change of input dataset not working inside of modal #61

Open
lhabegger opened this issue Mar 29, 2023 · 0 comments
Open

Comments

@lhabegger
Copy link

lhabegger commented Mar 29, 2023

First of all - thanks a lot for the great work.

Then: I am not sure if this issue is in any way related to #24 however, at least the outcome is different.

in the following simplified shiny application changing the dataset via selectInput and then choosing to Modify it via button does not work. Upon selection of second dataset, the resulting datatable is changed correctly. However when "modify" is pressed and the Modal appears the old dataset ("mtcars") is displayed again

library(shiny)

ui <- fluidPage(

  selectInput(inputId = "datasetSelector", label = "Choose Data Set",
              choices = c("mtcars", "iris")),
  actionButton("modify","Modify"),
  DT::dataTableOutput("mytable")

)

server <- function(input, output) {

  dataset <- reactive({
    get(input$datasetSelector)
  })

  observeEvent(input$modify,{
    showModal(modalDialog(
      DataEditR::dataEditUI("editor")
    ))
  })

  editedTbl <- DataEditR::dataEditServer("editor", data = dataset)

  output$mytable = DT::renderDataTable({
    editedTbl()
  })

}

# Run the application
shinyApp(ui = ui, server = server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant