PDA

View Full Version : clean a dirty cell in grid



emredagli
11 Sep 2009, 1:06 AM
Hii,
I need to clean a dirty "cell" in the grid.
I search the API but all methods related with cleaning all fields in a record.

I hope it can be done without big effort.

Example:
I have a switched online icon in the grid (using cellactions plugin of Great Saki)
if you click offline icon, current online icon is switched off in the grid.
So, 2 cells marked as dirty in that case.
I can not clean previous record because I have another editable fields (:|

Thanks a lot.

jarlau
11 Sep 2009, 1:22 AM
you want this (http://www.extjs.com/deploy/dev/docs/?class=Ext.data.Record&member=commit)?

emredagli
11 Sep 2009, 1:29 AM
Dear Jarlau,

Not exactly,
I need something,

commit (http://www.extjs.com/forum/../deploy/dev/docs/source/Record.html#method-Ext.data.Record-commit)( [Boolean silent] , [String fieldName])

jarlau
11 Sep 2009, 1:50 AM
how abt this (http://www.extjs.com/deploy/dev/docs/?class=Ext.grid.EditorGridPanel&member=validateedit)? there is an example.

Condor
11 Sep 2009, 5:09 AM
So you are looking for:

Ext.override(Ext.data.Record, {
commitField: function(silent, field){
if(!field){
return this.commit();
}
if(this.modified){
delete this.modified[field];
var modified = false;
for(var f in this.modified){
if(this.modified.hasOwnProperty(f)){
modified = true;
break;
}
}
if(!modified){
return this.commit();
}
if(silent !== true){
this.afterEdit();
}
}
}
});

emredagli
15 Sep 2009, 9:50 PM
So you are looking for:

Ext.override(Ext.data.Record, {
commitField: function(silent, field){
if(!field){
return this.commit();
}
if(this.modified){
delete record.modified[field];
if(!record.modified.length){
return this.commit();
}
if(silent !== true){
this.afterEdit();
}
}
}
});

Thanks Condor,
Only one correction is "record" --> "this"

Best wishes.

Condor
15 Sep 2009, 10:47 PM
There were more problems with that code. Try the updated version.