'DT editable = "column" not functional
In the examples on https://yihui.shinyapps.io/DT-edit/, when editable = "column" the results won't render and be retained in the table. Indeed, they only work if editable = TRUE or editable = "cell".
From the following code culled from link above, I added a Click button to see what was in input elements.
When you Click following selecting a cell with editable = "column" (which allows input to column cells), no changes re seen in input$x1_columns_selected.
Can anyone specify why and if this used to work correctly? I cannot see how a feature like this would be broken, it seems very useful.
library(shiny)
library(DT)
dt_output = function(title, id) {
fluidRow(column(
12, h1(paste0('Table ', sub('.*?([0-9]+)$', '\\1', id), ': ', title)),
hr(),
actionButton("click_action", "Click"),
hr(),
DTOutput(id)
))
}
render_dt = function(data, editable = 'cell', server = TRUE, ...) {
renderDT(data, selection = 'none', server = server, editable = editable, ...)
}
shinyApp(
ui = fluidPage(
title = 'Double-click to edit table cells',
dt_output('client-side processing (editable = "column")', 'x1'),
),
server = function(input, output, session) {
d1 = iris[1:5,]
d1$Date = Sys.time() + seq_len(nrow(d1))
# client-side processing
output$x1 = render_dt(d1, 'column', FALSE)
observe(str(input$x1_cell_edit))
observeEvent(input$click_action, {
print(input)
print(input$x1_cells_selected)
print(input$x1_columns_selected)
print(input$x1_rows_all)
print(input$x1_rows_current)
print(input$x1_rows_selected)
print(input$x1_search)
#print(input$x1_state)
})
}
)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
