Selecting single row in shiny using DT

6.6k Views Asked by At

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?

Thanks

1

There are 1 best solutions below

4
On BEST ANSWER

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.