@@ -1838,6 +1838,9 @@ See http://createjs.org for more information
1838
1838
widget . element . on ( widget . options . editableNs + 'changed' , function ( event , options ) {
1839
1839
if ( _ . indexOf ( widget . changedModels , options . instance ) === - 1 ) {
1840
1840
widget . changedModels . push ( options . instance ) ;
1841
+ options . instance . midgardStorageVersion = 1 ;
1842
+ } else {
1843
+ options . instance . midgardStorageVersion ++ ;
1841
1844
}
1842
1845
widget . _saveLocal ( options . instance ) ;
1843
1846
} ) ;
@@ -2002,15 +2005,18 @@ See http://createjs.org for more information
2002
2005
options : options
2003
2006
} ) ;
2004
2007
2005
- var widget = this ;
2008
+ var widget = this ,
2009
+ previousVersion = model . midgardStorageVersion ;
2006
2010
model . save ( null , _ . extend ( { } , options , {
2007
2011
success : function ( m , response ) {
2008
2012
// From now on we're going with the values we have on server
2009
2013
model . _originalAttributes = _ . clone ( model . attributes ) ;
2010
2014
widget . _removeLocal ( model ) ;
2011
2015
window . setTimeout ( function ( ) {
2012
- // Remove the model from the list of changed models after saving
2013
- widget . changedModels . splice ( widget . changedModels . indexOf ( model ) , 1 ) ;
2016
+ // Remove the model from the list of changed models after saving if no other change was made to the model
2017
+ if ( model . midgardStorageVersion == previousVersion ) {
2018
+ widget . changedModels . splice ( widget . changedModels . indexOf ( model ) , 1 ) ;
2019
+ }
2014
2020
} , 0 ) ;
2015
2021
if ( _ . isFunction ( options . success ) ) {
2016
2022
options . success ( m , response ) ;
0 commit comments