@@ -31,6 +31,7 @@ export default (
3131
3232 constructor ( props ) {
3333 super ( props ) ;
34+ this . doUpdate = this . doUpdate . bind ( this ) ;
3435 this . startEditing = this . startEditing . bind ( this ) ;
3536 this . escapeEditing = this . escapeEditing . bind ( this ) ;
3637 this . completeEditing = this . completeEditing . bind ( this ) ;
@@ -55,11 +56,36 @@ export default (
5556 }
5657
5758 handleCellUpdate ( row , column , newValue ) {
58- const { keyField , cellEdit, data } = this . props ;
59- const { beforeSaveCell, afterSaveCell } = cellEdit . options ;
59+ const { cellEdit } = this . props ;
60+ const { beforeSaveCell } = cellEdit . options ;
6061 const oldValue = _ . get ( row , column . dataField ) ;
62+ const beforeSaveCellDone = ( result = true ) => {
63+ if ( result ) {
64+ this . doUpdate ( row , column , newValue ) ;
65+ } else {
66+ this . escapeEditing ( ) ;
67+ }
68+ } ;
69+ if ( _ . isFunction ( beforeSaveCell ) ) {
70+ const result = beforeSaveCell (
71+ oldValue ,
72+ newValue ,
73+ row ,
74+ column ,
75+ beforeSaveCellDone
76+ ) ;
77+ if ( _ . isObject ( result ) && result . async ) {
78+ return ;
79+ }
80+ }
81+ this . doUpdate ( row , column , newValue ) ;
82+ }
83+
84+ doUpdate ( row , column , newValue ) {
85+ const { keyField, cellEdit, data } = this . props ;
86+ const { afterSaveCell } = cellEdit . options ;
6187 const rowId = _ . get ( row , keyField ) ;
62- if ( _ . isFunction ( beforeSaveCell ) ) beforeSaveCell ( oldValue , newValue , row , column ) ;
88+ const oldValue = _ . get ( row , column . dataField ) ;
6389 if ( isRemoteCellEdit ( ) ) {
6490 handleCellChange ( rowId , column . dataField , newValue ) ;
6591 } else {
0 commit comments