Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selecting single row in shiny using DT

Tags:

r

shiny

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

like image 540
Iain Avatar asked Jun 08 '15 01:06

Iain


1 Answers

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.
like image 143
Yihui Xie Avatar answered Oct 15 '22 02:10

Yihui Xie