I saw this tweet of @mara and I was happily playing with the DTedit package, but now I'm stuck with this problem.
Does anyone know how to update 'thedata' parameter for this object? something similar to updateSelectInput
maybe?. I want this output to reflect changes in the underlying data frame made by other controls (actionButton).
I can't find this in the documentation of the package, and there is no issues section on it's github page.
I have tried just re-rendering the dtedit object every time a change is made to the dataframe and parcially works but, when I do this, I get random erros with the add, modify, delete controls that sometimes show wrong or obsolete data (already deleted).
# Callback functions
my.insert.callback <- function(data, row) {
sale_detail <<- data
return(sale_detail)
}
my.update.callback <- function(data, olddata, row) {
sale_detail <<- data
return(sale_detail)
}
my.delete.callback <- function(data, row) {
sale_detail <<- data[-row,]
return(sale_detail)
}
# Render dtedit object
dtedit(input, output,
name = 'sale',
thedata = sale_detail,
edit.cols = c('quantity', 'sale_price', 'total'),
edit.label.cols = c('Quantity', 'Price', 'Total'),
view.cols = c('id_sale','basic_text', 'quantity', 'sale_price', 'total'),
show.insert = FALSE,
show.copy = FALSE,
callback.delete = my.delete.callback,
callback.update = my.update.callback,
callback.insert = my.insert.callback
)