Sofiane M'barki
Sofiane M'barki

Reputation: 193

Make datatable #DT rownames not clickable

I have a table made with the DT package where my cells are clickable. However, I would like to have the cells in the row names not clickable or in other word, specify a range of columns, something like ‘selected = [2:5]’ where cells are actually active for a click base behavior.

Hope the problem is quiet enough visual. Thanks for your help.

Upvotes: 1

Views: 528

Answers (1)

Stéphane Laurent
Stéphane Laurent

Reputation: 84519

You mean the click for the selection ? The code below works for me but I'm not using the latest version of DT.

  output$dtable <- renderDT({
    datatable(iris, extensions = "Select", selection = "none",
              options = list(
                columnDefs = list(
                  list(className = "not-selectable", targets = 0)
                ),
                select = list(
                  style = "single",
                  selector = "td:not(.not-selectable)"
                )
              )
    )
  })

Upvotes: 1

Related Questions