Code to reproduce the issue:
(shiny version 1.6.0, DT version 0.18)
library(shiny)
library(DT)
ui <- fluidPage(
br(),
DTOutput("tbl"),
br()
)
server <- function(input, output, session){
output$tbl <- renderDT({
datatable(mtcars, extensions = "ColReorder",
options = list(colReorder = TRUE)
)
})
}
shinyApp(ui, server)
- Click in a column header (for example qsec). Check that the order is correct.
- Drag the column to another position
- Click in the column header of the dragged column. Check that the order is incorrect.
It seems to me that it looses the right indexing when dragging and dropping. I have tried to run the datatable without Shiny and it works well.
Am I missing something?