react-grid icon indicating copy to clipboard operation
react-grid copied to clipboard

Row selection controllers

Open andreypopp opened this issue 10 years ago • 1 comments

We need to implement row selection controllers which would allow different models for selecting rows in a grid.

Features we want (these can be ended up in different row selection controllers implementations though):

  • Focus row with mouse
  • Move focus with keyboard
  • Select multiple rows with mouse
    • by holding a Shift key
    • in a special multiple selection mode
  • Remove focus with Esc key

andreypopp avatar May 07 '14 16:05 andreypopp

I've been trying out a few solutions to moving focus with keyboard navigation let me know if you had any thoughts on the right solution to this My initial proof of concept was to store ActiveCell : { cell: 0, row: 0 } in state and then pass this down didnt feel that neat, but the bulk of the approach can be seen here: https://github.com/adazzle/react-grid/commit/15edb336aff4105cac1388ac0b6adcb0b950242a

and its designed from an excel-style grid point of view, so wont cope with multiple selections, etc (though shouldn't be hard to extend that)

Also - for mouse selection of a cell, this will require the click handler to be aware of the row and cell indexes, and then pass this upto the owner of the grid state. So maybe a neater approach would be for the state of selection to be owned within a selection controller? The issue there that stopped em going down that path is that you would probably want to do a few of the following:

  • mark a cell / row to indicate it is selected
  • do things in other controller with selected cell(s)/row(s), such as copy and paste, editors, etc

bakesteve avatar Jul 07 '14 22:07 bakesteve