@@ -11,31 +11,29 @@ class TableRow extends Component {
11
11
rowClick = e => {
12
12
const rowIndex = this . props . index + 1 ;
13
13
if ( this . props . onRowClick ) this . props . onRowClick ( rowIndex ) ;
14
- if ( e . target . tagName === 'TD' ) {
15
- const cellIndex = e . target . cellIndex ;
16
- const { selectRow, unselectableRow, isSelected, onSelectRow, onExpandRow } = this . props ;
17
- if ( selectRow ) {
18
- if ( selectRow . clickToSelect && ! unselectableRow ) {
19
- onSelectRow ( rowIndex , ! isSelected , e ) ;
20
- } else if ( selectRow . clickToSelectAndEditCell && ! unselectableRow ) {
21
- this . clickNum ++ ;
22
- /** if clickToSelectAndEditCell is enabled,
23
- * there should be a delay to prevent a selection changed when
24
- * user dblick to edit cell on same row but different cell
25
- **/
26
- setTimeout ( ( ) => {
27
- if ( this . clickNum === 1 ) {
28
- onSelectRow ( rowIndex , ! isSelected , e ) ;
29
- onExpandRow ( rowIndex , cellIndex ) ;
30
- }
31
- this . clickNum = 0 ;
32
- } , 200 ) ;
33
- } else {
34
- this . expandRow ( rowIndex , cellIndex ) ;
35
- }
14
+ const cellIndex = e . target . cellIndex ;
15
+ const { selectRow, unselectableRow, isSelected, onSelectRow, onExpandRow } = this . props ;
16
+ if ( selectRow ) {
17
+ if ( selectRow . clickToSelect && ! unselectableRow ) {
18
+ onSelectRow ( rowIndex , ! isSelected , e ) ;
19
+ } else if ( selectRow . clickToSelectAndEditCell && ! unselectableRow ) {
20
+ this . clickNum ++ ;
21
+ /** if clickToSelectAndEditCell is enabled,
22
+ * there should be a delay to prevent a selection changed when
23
+ * user dblick to edit cell on same row but different cell
24
+ **/
25
+ setTimeout ( ( ) => {
26
+ if ( this . clickNum === 1 ) {
27
+ onSelectRow ( rowIndex , ! isSelected , e ) ;
28
+ onExpandRow ( rowIndex , cellIndex ) ;
29
+ }
30
+ this . clickNum = 0 ;
31
+ } , 200 ) ;
36
32
} else {
37
33
this . expandRow ( rowIndex , cellIndex ) ;
38
34
}
35
+ } else {
36
+ this . expandRow ( rowIndex , cellIndex ) ;
39
37
}
40
38
}
41
39
0 commit comments