PDA

View Full Version : [FIXED] [V0.7] GridPanel.Reload shows DirtyWarning even if WarningOnDirty=False



jchau
Oct 24, 2008, 7:21 PM
Here's my scenario: I have a page with tree of folders on the left and a grid of files on the right (simple file explorer layout). There's a button to delete a selected file. When that button is clicked, it does an AjaxEvent to the page to check if file can be deleted. If file can be deleted, AjaxEvent success is set to true. On the button success handler, it does a Grid.deleteSelected().

Now the issue is that after a delete and I click on a different folder, it does a Grid.Reload and prompts me with a Dirty Warning. I have set WarningOnDirty="false" on the store. I spent alot of time debugging this and finally realized this is not an ExtJS thing but a Coolite thing.

In coolite-data.js, Ext.data.Store is extended with a reload function that invokes callbackReload and hardcode dirtyConfirm to true. Shouldn't it use the WarningOnDirty flag?


reload: function(options) {
if (this.proxy.refreshByUrl) {
var opts = options || {};
var prms = opts.params || {};
this.callbackReload(true, prms);
} else {
Coolite.Ext.Store.superclass.reload.call(this, options);
}
},

callbackReload: function(dirtyConfirm, reloadOptions) {
...
if (dirtyConfirm && this.isDirty()) {
Ext.MessageBox.confirm(
this.dirtyWarningTitle,
this.dirtyWarningText,
function(btn, text) {
if (btn == 'yes') {
reload(this, options);
}
},
this
);
}
...
}

jchau
Oct 24, 2008, 7:22 PM
Doh. Right after I posted this, I realized I can do a store.commitChanges to clear the array of deleted items. But I still think this is a bug.

Vladimir
Oct 25, 2008, 6:10 AM
Hi jchau,

Yes, you are right, it is a bug. Thanks for bug reporting.

The fix will be public available in the new Release