Iain
Iain

Reputation: 1638

Selecting single row in shiny using DT

Based on this example, I am trying to select only a single row and consequently highlight a single point.

I have changed the line datatable(cars) to datatable(cars,selection = 'single') as per the documentation which limits the selection to only one row.

However, after selecting more than once even though only one row is highlighted all previous points stay highlighted.

Is there a way of ensuring that only one row is returned from the selection i.e. that all previous selections are cleared?

Upvotes: 15

Views: 6944

Answers (1)

Yihui Xie
Yihui Xie

Reputation: 30104

This is a bug in DT, and I just fixed it (sorry about that). There are two ways to solve the problem, and you can use either one:

  1. Install the development version on Github;
  2. Or use renderDataTable(server = FALSE) if your data object is not too big.

Upvotes: 15

Related Questions