PDA

View Full Version : Can`t clear durty cell in grid after editing.



Zanisimo
20 Jan 2011, 11:27 PM
Hi all. I have problem, that i can`t clear the the red triangle from cell after i edit it. I know, that you there is commit method, but i am editing cell in a different way.

On double click row i call a window with form in which i edit some of rows values. The form is submitted to server and when server answers with success i edit the rows information.

This is the function that is called when i submit the form:


editTask: function() {
this.taskEditForm.getForm().submit({
success: function(form,action) {
this.editTaskWin.close();
var vars = action.result;
var edit_store = this.store.getById(vars.id);
edit_store.set('title',vars.title);
edit_store.dirty = false;
},
failure: function(form,action) {
},
scope: this
});
}


I am quite new in Ext JS and i know that this may not be the correct way of doing this. I think that i need to get the index of grid`s row and commit it, but i haven't found a way to get the index.

I know that i can disable the red triangle in css, but that is not acceptable to me and i want to do this in a correct way.

Can any one help me?

mashiki
20 Jan 2011, 11:48 PM
commit is need.

Ext.data.Record >
commit( [Boolean silent] ) : void

>Usually called by the Ext.data.Store which owns the Record. Commits all changes made to the Record since either creation, or the last commit operation.
>Developers should subscribe to the Ext.data.Store.update event to have their code notified of commit operations.

I asked same question. 2 years ago :-)

Zanisimo
20 Jan 2011, 11:57 PM
Thank you very much. I can`t believe that i didn't try commit on the store record.

So to help others the code now looks like this. I didn't need to use edit_store.dirty = false; In stead i just added edit_store.commit();


editTask: function() {
this.taskEditForm.getForm().submit({
success: function(form,action) {
this.editTaskWin.close();
var vars = action.result;
var edit_store = this.store.getById(vars.id);
edit_store.set('title',vars.title);
edit_store.commit();
},
failure: function(form,action) {
},
scope: this
});
},

Zanisimo
21 Jan 2011, 12:01 AM
P.S. As i am new to this forum, how can i set this thread to SOLVED?