galaxy--
galaxy--

Reputation: 172

Shiny DT lock some columns AND rows for editing

What I want is that only certain cells are editable by the user, for example in the iris dataset I want the first 3 rows to be locked and also the second and the third column.

I have found the same question here on SO (Shiny datatable mode editable - restrict specific columns AND ROWS), however unfortunately the provided solution does not work (as there only the columns get locked after running the code). Here is a minimal reprex.

as you can see I wrote both the respective columns and rows in the argument, however only the columns got locked.

library(shiny)

library(DT)


ui <- fluidPage(
  DTOutput("table")
)

dat <- iris[1:10, ]

server <- function(input, output, session){
  
  output$table <- renderDT({
    datatable(dat, editable = list(target='cell', disable = list(columns = c(2:3), rows=c(1:3) )))
  }, server = FALSE)
  

  
}

shinyApp(ui, server)

Upvotes: 4

Views: 519

Answers (1)

galaxy--
galaxy--

Reputation: 172

With the newest update of DT, this issue seems to be resolved, now rows and columns can get locked

Upvotes: 1

Related Questions