@@ -24,13 +24,16 @@ class TableEditColumn extends Component {
24
24
25
25
handleKeyPress = e => {
26
26
if ( e . keyCode === 13 || e . keyCode === 9 ) {
27
- // Pressed ENTER
27
+ // Pressed ENTER or TAB
28
28
const value = e . currentTarget . type === 'checkbox' ?
29
29
this . _getCheckBoxValue ( e ) : e . currentTarget . value ;
30
30
31
- if ( ! this . validator ( value ) ) {
31
+ // TAB triggers blur so no need to notify
32
+ const notify = e . keyCode !== 9 || ! this . props . blurToSave ;
33
+ if ( ! this . validator ( value , notify ) ) {
32
34
return ;
33
35
}
36
+
34
37
if ( e . keyCode === 13 ) {
35
38
this . props . completeEdit ( value , this . props . rowIndex , this . props . colIndex ) ;
36
39
} else {
@@ -72,18 +75,18 @@ class TableEditColumn extends Component {
72
75
73
76
// modified by iuculanop
74
77
// BEGIN
75
- validator ( value ) {
78
+ validator ( value , notify = true ) {
76
79
const ts = this ;
77
80
let valid = true ;
78
81
if ( ts . props . editable . validator ) {
79
82
const checkVal = ts . props . editable . validator ( value , this . props . row ) ;
80
83
const responseType = typeof checkVal ;
81
84
if ( responseType !== 'object' && checkVal !== true ) {
82
85
valid = false ;
83
- this . notifyToastr ( 'error' , checkVal , '' ) ;
86
+ notify && this . notifyToastr ( 'error' , checkVal , '' ) ;
84
87
} else if ( responseType === 'object' && checkVal . isValid !== true ) {
85
88
valid = false ;
86
- this . notifyToastr ( checkVal . notification . type ,
89
+ notify && this . notifyToastr ( checkVal . notification . type ,
87
90
checkVal . notification . msg ,
88
91
checkVal . notification . title ) ;
89
92
}
0 commit comments