PDA

View Full Version : is possible to clean model dirty flag ?



maneljn
2 Nov 2011, 7:11 AM
i have this



// Recoger totales de alb calculados y poner en el store de cabeceras
registroAlb = storeVentasAlbaranes.getById( parseInt( registro.get('valblin_albaran_id') ));
registroAlb.set('valb_base',respuesta.totalesAlb.base);
registroAlb.set('valb_total',respuesta.totalesAlb.total);


and i want to "clear" the dirty flag to avoid showing red triangle in grid.

redraid
2 Nov 2011, 7:22 AM
Commit model changes:registroAlb.commit();

maneljn
2 Nov 2011, 7:29 AM
but i don't want to save anything in the sql database.
i set this 2 values just for show.

the solution is valid also ?

redraid
2 Nov 2011, 11:59 PM
Yes, commit not save changes via proxy, to save use model.save() method.

whalethewise
3 Nov 2011, 5:00 AM
but commit does not clear dirty flag.

redraid
3 Nov 2011, 7:06 AM
/**
* Usually called by the {@link Ext.data.Store} which owns the model instance. Commits all changes made to the
* instance since either creation or the last commit operation.
*
* Developers should subscribe to the {@link Ext.data.Store#update} event to have their code notified of commit
* operations.
*
* @param {Boolean} silent (optional) True to skip notification of the owning store of the change.
* Defaults to false.
*/
commit : function(silent) {
var me = this;

me.phantom = me.dirty = me.editing = false;
me.modified = {};

if (silent !== true) {
me.afterCommit();
}
},

whalethewise
3 Nov 2011, 7:42 AM
Ok, thanks

Do you know what keeps this red corner mark on updated fields after commit?

redraid
3 Nov 2011, 7:52 AM
In my app after record.commit() red corners disappear, pls show code.