I would like to use the packages reactable and reactable.extras in Shiny to create an interactive table in which users can select and update a cell element themselves via dropdown.
However, I don't know how to obtain the entered cell values in order to continue using the updated table.
Although the dropdown has an input id (in my example case: input$dropdown1), this is the id of the last cell entered.
However, I can't seem to get all (!) the values out of the dropdown column.
Can someone help me to get the values updated by the user via dropdown so that I can continue to use them?
Here is my example code:
library(shiny)
library(dplyr)
library(reactable)
library(reactable.extras)
df <- mtcars %>% select(mpg, cyl, carb)
shinyApp(
ui = fluidPage(
reactable_extras_dependency(),
reactableOutput("react")
),
server = function(input, output) {
output$react <- renderReactable({
reactable(
df,
columns = list(
carb = colDef(cell = dropdown_extra(id = "dropdown1", unique(df$carb), class = "dropdown-extra"))
)
)
})
}
)

Disclaimer : I have not used
reactableorreactable.extras, so if there is a way to do this within the package I am not aware of it.One suggestion from my end is to turn the dataframe into reactive object,
input$dropdown1has information about row and column and the value that has changed. Using that we can update the reactive dataframe whenever the dropdown is selected.For demonstration purpose, I am rendering another table to verify the changes being updated in the reactive object. You can definitely extract the entire column from the dataframe if that is what you are interested in.