lib/netzke/basepack/grid_panel/javascripts/event_handling.js in netzke-basepack-0.7.4 vs lib/netzke/basepack/grid_panel/javascripts/event_handling.js in netzke-basepack-0.7.5

- old
+ new

@@ -35,42 +35,44 @@ } }, this); }, onApply: function(){ - var newRecords = [], - updatedRecords = [], - store = this.getStore(); + if (this.fireEvent('apply')) { + var newRecords = [], + updatedRecords = [], + store = this.getStore(); - Ext.each(store.getUpdatedRecords().concat(store.getNewRecords()), - function(r) { - if (r.isNew) { - newRecords.push(r.data); // HACK: r.data seems private - } else { - updatedRecords.push(Ext.apply(r.getChanges(), {id:r.getId()})); - } - }, - this); + Ext.each(store.getUpdatedRecords().concat(store.getNewRecords()), + function(r) { + if (r.isNew) { + newRecords.push(r.data); // HACK: r.data seems private + } else { + updatedRecords.push(Ext.apply(r.getChanges(), {id:r.getId()})); + } + }, + this); - if (newRecords.length > 0 || updatedRecords.length > 0) { - var params = {}; + if (newRecords.length > 0 || updatedRecords.length > 0) { + var params = {}; - if (newRecords.length > 0) { - params.created_records = Ext.encode(newRecords); - } + if (newRecords.length > 0) { + params.created_records = Ext.encode(newRecords); + } - if (updatedRecords.length > 0) { - params.updated_records = Ext.encode(updatedRecords); - } + if (updatedRecords.length > 0) { + params.updated_records = Ext.encode(updatedRecords); + } - if (this.getStore().getProxy().extraParams !== {}) { - params.base_params = Ext.encode(this.getStore().getProxy().extraParams); - } + if (this.getStore().getProxy().extraParams !== {}) { + params.base_params = Ext.encode(this.getStore().getProxy().extraParams); + } - this.postData(params); + this.postData(params); + } } - + this.fireEvent('afterApply', this); }, // Handlers for tools // @@ -172,6 +174,6 @@ // Destroy the search window (here's the problem: we are not supposed to know it exists) if (this.searchWindow) { this.searchWindow.destroy(); } } -} \ No newline at end of file +}