From: Bill Erickson Date: Mon, 19 Mar 2012 15:10:55 +0000 (-0400) Subject: AutoGrid generic onPostSubmit handler X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=51b6fd0b5b75124e20598a9bc20cc8d167b3434e;p=evergreen%2Fmasslnc.git AutoGrid generic onPostSubmit handler Called w/ no arguments after any CRUD actions occur. This includes EditPane / EditDialog actions as well as deleteSelected. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js index 947d56c844..715a7c02c9 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js @@ -16,6 +16,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { /* if true, pop up an edit dialog when user hits Enter on a give row */ editPaneOnSubmit : null, + onPostSubmit : null, // called after any CRUD actions are complete createPaneOnSubmit : null, editOnEnter : false, defaultCellWidth : null, @@ -347,19 +348,14 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { fmObject, { oncomplete : function(r) { self.store.deleteItem(item); - if (--total < 1) { - try { - xulG.reload_opac(); - } catch (E) { - (dump ? dump : console.log)(E); - } + if (--total < 1 && self.onPostSubmit) { + self.onPostSubmit(); } } } ); } ); - }, _formatRowSelectInput : function(rowIdx) { @@ -410,7 +406,6 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { var grid = this; var fmObject = new fieldmapper[this.fmClass]().fromStoreItem(storeItem); var idents = grid.store.getIdentityAttributes(); - var self = this; var pane = new openils.widget.EditPane({ fmObject:fmObject, @@ -429,8 +424,8 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { continue; // don't try to edit an identifier field grid.store.setValue(storeItem, field, fmObject[field]()); } - if(self.onPostUpdate) - self.onPostUpdate(storeItem, rowIndex); + if(grid.onPostUpdate) + grid.onPostUpdate(storeItem, rowIndex); setTimeout( function(){ try { @@ -440,6 +435,9 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { ); if(onPostSubmit) onPostSubmit(); + if (grid.onPostSubmit) + grid.onPostSubmit(); + }, onCancel : function() { setTimeout(function(){ @@ -479,6 +477,8 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { },200); if(onPostSubmit) onPostSubmit(fmObject); + if (grid.onPostSubmit) + grid.onPostSubmit(); }, onCancel : function() { if(onCancel) onCancel();