I have a store (with proxy 'memory') and I have an array of models, when I create one model I setted his propety using set(field,newValue) but this methode marks it as derty, I want to know I can set a value of field and not mark it as dirty, here is my example:
for(var i=0;i<questions.length;++i){
var question=Ext.create('DCM.model.TCL');
question.set('scope',questions[i].scope);
question.set('topic',questions[i].topic);
question.set('area',questions[i].area);
question.set('target',questions[i].target);
var responses=questions[i].responses;
var sumJan=0,nbResponsesJan=0;
var sumFeb=0,nbResponsesFeb=0;
var sumMar=0,nbResponsesMar=0;
var sumApr=0,nbResponsesApr=0;
var sumMay=0,nbResponsesMay=0;
var sumJun=0,nbResponsesJun=0;
var sumJul=0,nbResponsesJul=0;
var sumAout=0,nbResponsesAout=0;
var sumSep=0,nbResponsesSep=0;
var sumOct=0,nbResponsesOct=0;
var sumNov=0,nbResponsesNov=0;
var sumDec=0,nbResponsesDec=0;
for(var j=0;j<responses.length;++j){
switch(responses[j].month){
case 0:sumJan+=responses[j].score;++nbResponsesJan;break;
case 1:sumFeb+=responses[j].score;++nbResponsesFeb;break;
case 2:sumMar+=responses[j].score;++nbResponsesMar;break;
case 3:sumApr+=responses[j].score;++nbResponsesApr;break;
case 4:sumMay+=responses[j].score;++nbResponsesMay;break;
case 5:sumJun+=responses[j].score;++nbResponsesJun;break;
case 6:sumJul+=responses[j].score;++nbResponsesJul;break;
case 7:sumAout+=responses[j].score;++nbResponsesAout;break;
case 8:sumSep+=responses[j].score;++nbResponsesSep;break;
case 9:sumOct+=responses[j].score;++nbResponsesOct;break;
case 10:sumNov+=responses[j].score;++nbResponsesNov;break;
case 11:sumDec+=responses[j].score;++nbResponsesDec;break;
}
}
if(nbResponsesJan>0){
question.set('jan',sumJan/nbResponsesJan);
}
if(nbResponsesFeb>0){
question.set('feb',sumFeb/nbResponsesFeb);
}
if(nbResponsesMar>0){
question.set('mar',sumMar/nbResponsesMar);
}
if(nbResponsesApr>0){
question.set('apr',sumApr/nbResponsesApr);
}
if(nbResponsesMay>0){
question.set('may',sumMay/nbResponsesMay);
}
if(nbResponsesJun>0){
question.set('jun',sumJun/nbResponsesJun);
}
if(nbResponsesJul>0){
question.set('jul',sumJul/nbResponsesJul);
}
if(nbResponsesAout>0){
question.set('aout',sumAout/nbResponsesAout);
}
if(nbResponsesSep>0){
question.set('sep',sumSep/nbResponsesSep);
}
if(nbResponsesOct>0){
question.set('oct',sumOct/nbResponsesOct);
}
if(nbResponsesNov>0){
question.set('nov',sumNov/nbResponsesNov);
}
if(nbResponsesDec>0){
question.set('dec',sumDec/nbResponsesDec);
}
questionsModel[i]=question;
}
tclController.getStore('TCL').loadRawData(questionsModel);
}
the rows of my grid look like dirty records, How to resolve it.
Thanx.
call question.commit()
this will do:
me.phantom = me.dirty = me.editing = false;