当Ext.grid.GridPanel采用RowEditor进行编辑和更新时,若采用store监听update的方法,可能会向server发两次相同的提交指令...
原因不明,估计可能是store.commitChanges()会产生一次命令..
虽然不影响功能,但始终觉得不妥,改用editor的afteredit事件进行Upload,如下,一切正常...
editor.on({
scope: this,
afteredit: function(roweditor, changes, record, rowIndex) {
//your save logic here - might look something like this:
Ext.Ajax.request({
url : record.phantom ? '/users' : '/users/' + record.get('user_id'),
method: record.phantom ? 'POST' : 'PUT',
params: changes,
success: function() {
//post-processing here - this might include reloading the grid if there are calculated fields
store.comminChanges();
}
});
}
});