@@ -342,12 +342,13 @@ class TableBody extends Component {
342
342
if ( expandColumnVisible ) columnIndex ++ ;
343
343
this . handleCompleteEditCell ( e . target . value , rowIndex , columnIndex - 1 ) ;
344
344
if ( columnIndex >= this . props . columns . length ) {
345
- rowIndex = rowIndex + 1 ;
346
- columnIndex = 1 ;
347
345
this . handleCellKeyDown ( e , true ) ;
348
346
} else {
349
347
this . handleCellKeyDown ( e ) ;
350
348
}
349
+ const { nextRIndex, nextCIndex } = this . nextEditableCell ( rowIndex , columnIndex ) ;
350
+ rowIndex = nextRIndex ;
351
+ columnIndex = nextCIndex ;
351
352
}
352
353
353
354
const stateObj = {
@@ -366,6 +367,32 @@ class TableBody extends Component {
366
367
this . setState ( stateObj ) ;
367
368
}
368
369
370
+ nextEditableCell = ( rIndex , cIndex ) => {
371
+ const { keyField } = this . props ;
372
+ let nextRIndex = rIndex ;
373
+ let nextCIndex = cIndex ;
374
+ let row ;
375
+ let column ;
376
+ do {
377
+ if ( nextCIndex >= this . props . columns . length ) {
378
+ nextRIndex ++ ;
379
+ nextCIndex = 0 ;
380
+ }
381
+ row = this . props . data [ nextRIndex ] ;
382
+ column = this . props . columns [ nextCIndex ] ;
383
+ if ( ! row ) break ;
384
+ let editable = column . editable ;
385
+ if ( isFun ( column . editable ) ) {
386
+ editable = column . editable ( column , row , nextRIndex , nextCIndex ) ;
387
+ }
388
+ if ( editable && ! column . hidden && keyField !== column . name ) break ;
389
+ else {
390
+ nextCIndex ++ ;
391
+ }
392
+ } while ( row ) ;
393
+ return { nextRIndex, nextCIndex } ;
394
+ }
395
+
369
396
handleCompleteEditCell = ( newVal , rowIndex , columnIndex ) => {
370
397
this . setState ( { currEditCell : null } ) ;
371
398
if ( newVal !== null ) {
0 commit comments