I use DT::renderDataTable to render a data table for a Shiny app and I use editable = TRUE
in the definition of datatable()
. The data
argument of datatable
is a reactive expression that gets data from a database based on the selected value from a dropdown menu. I want to be able to have a button that refreshes the datatable and discards any user edits, just like selecting another value from the dropdown menu. I can't give you a reproducible example because I am using proprietary code and data that come from a database. I know I can use an observeEvent
on the refresh button click event and then call the render function of the table, but I am looking for a more elegant approach. Thanks
Found out that you can use proxy <- datatableProxy()
and then reloadData(proxy)
inside the observeEvent of the refresh button. This would cancel any datatable edits made.