@@ -252,7 +252,7 @@ class TableBody extends Component {
252
252
253
253
handleCellKeyDown = ( e , lastEditCell ) => {
254
254
e . preventDefault ( ) ;
255
- const { keyBoardNav, onNavigateCell, cellEdit } = this . props ;
255
+ const { keyBoardNav, onNavigateCell, cellEdit, selectedRowKeys } = this . props ;
256
256
let offset ;
257
257
if ( e . keyCode === 37 ) {
258
258
offset = { x : - 1 , y : 0 } ;
@@ -269,21 +269,30 @@ class TableBody extends Component {
269
269
} else if ( e . keyCode === 40 ) {
270
270
offset = { x : 0 , y : 1 } ;
271
271
} else if ( e . keyCode === 13 ) {
272
+ const rowIndex = e . target . parentElement . rowIndex + 1 ;
272
273
const enterToEdit = typeof keyBoardNav === 'object' ?
273
274
keyBoardNav . enterToEdit :
274
275
false ;
275
276
const enterToExpand = typeof keyBoardNav === 'object' ?
276
277
keyBoardNav . enterToExpand :
277
278
false ;
279
+ const enterToSelect = typeof keyBoardNav === 'object' ?
280
+ keyBoardNav . enterToSelect :
281
+ false ;
278
282
279
283
if ( cellEdit && enterToEdit ) {
280
- this . handleEditCell ( e . target . parentElement . rowIndex + 1 ,
281
- e . currentTarget . cellIndex , '' , e ) ;
284
+ this . handleEditCell ( rowIndex , e . currentTarget . cellIndex , '' , e ) ;
282
285
}
283
286
284
287
if ( enterToExpand ) {
285
288
this . handleClickCell ( this . props . y + 1 , this . props . x ) ;
286
289
}
290
+
291
+ if ( enterToSelect ) {
292
+ const isSelected = selectedRowKeys . indexOf (
293
+ this . props . data [ rowIndex - 1 ] [ this . props . keyField ] ) !== - 1 ;
294
+ this . handleSelectRow ( rowIndex , ! isSelected , e ) ;
295
+ }
287
296
}
288
297
if ( offset && keyBoardNav ) {
289
298
onNavigateCell ( offset ) ;
0 commit comments