PDA

View Full Version : Modified store records are NOT persisted during Paging on an editorgrid !!



terry.deng
17 Nov 2011, 2:41 AM
Hi, guys

does anyone have the experience doing paging on an editorgrid? Right now I am taking advantage of the Store function "getModifiedRecords()", on the API it says Modified records are persisted across load operations (e.g., during paging).

But when I make a change on page 1, go to page 2, come back to page 1, my changes are no longer in the editing grid. from the API docs I thought they would be preserved, though.....

I attached my codes below, all works well expect the problem I mentioned above.....I would appreciate if anyone could let me know how to preserve the edits during paging. thanks in advance!

{
icon: '../images/icons/save.png',
text: 'save',
type: 'submit',
handler: function(){
var m = store.getModifiedRecords();
if (m.length == 0){
Ext.MessageBox.show({
title: 'info',
msg: 'no modified records',
icon: Ext.MessageBox.WARNING,
buttons: Ext.MessageBox.OK,
closable: false
});
}
else{
var jsonArray = [];
Ext.each(m, function(item) {
jsonArray.push(item.data);
});

form.getForm().url = "saveOrUpdateUserInfo.action";

form.getForm().submit({
success: function(form, action){
Ext.MessageBox.show({
title: 'info',
msg: 'modified records are saved',
icon: Ext.MessageBox.INFO,
buttons: Ext.MessageBox.OK,
closable: false
});
store.reload();
},
failure: function(form, action){},
params: {data: encodeURIComponent(Ext.encode(jsonArray))}
});
}
}
}

terry.deng
17 Nov 2011, 6:16 AM
did I post the thread in the wrong place or nobody ever experienced this problem? is there a way to modify records in multiple pages during paging, and commit the changes once and for all?

terry.deng
17 Nov 2011, 6:45 AM
well, I think I figured out by myself......maybe it could be stupid way of doing it, but it works....I did a loop through all the modified records....