[open-ils-commits] r13942 - branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Sep 1 14:41:12 EDT 2009
Author: erickson
Date: 2009-09-01 14:41:07 -0400 (Tue, 01 Sep 2009)
New Revision: 13942
Modified:
branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
Log:
pass the clone object to the postsubmit handler. allow caller to specificy post-clone handler. added some docs
Modified: branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
===================================================================
--- branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js 2009-09-01 18:40:37 UTC (rev 13941)
+++ branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js 2009-09-01 18:41:07 UTC (rev 13942)
@@ -385,7 +385,8 @@
} catch (E) {}
},200
);
- if(onPostSubmit) onPostSubmit();
+ if(onPostSubmit)
+ onPostSubmit();
},
onCancel : function() {
setTimeout(function(){
@@ -419,7 +420,7 @@
} catch (E) {}
},200);
if(onPostSubmit)
- onPostSubmit();
+ onPostSubmit(fmObject);
},
onCancel : function() {
if(onCancel) onCancel();
@@ -430,7 +431,15 @@
return pane;
},
- // .startup() is called within
+ /**
+ * Creates an EditPane with a copy of the data from the provided store
+ * item for cloning said item
+ * @param {Object} storeItem Dojo data item
+ * @param {Number} rowIndex The Grid row index of the item to be cloned
+ * @param {Function} onPostSubmit Optional callback for post-submit behavior
+ * @param {Function} onCancel Optional callback for clone cancelation
+ * @return {Object} The clone EditPane
+ */
_makeClonePane : function(storeItem, rowIndex, onPostSubmit, onCancel) {
var clonePane = this._makeCreatePane(onPostSubmit, onCancel);
var origPane = this._makeEditPane(storeItem, rowIndex);
@@ -478,13 +487,20 @@
if(this.onEditPane) this.onEditPane(this.editPane);
},
- showClonePane : function() {
+ showClonePane : function(onPostSubmit) {
var self = this;
var done = function() { self.hidePane(); };
+
+
var row = this.getFirstSelectedRow();
if(!row) return;
+
+ var postSubmit = (onPostSubmit) ?
+ function(result) { onPostSubmit(self.getItem(row), result); self.hidePane(); } :
+ done;
+
dojo.style(this.domNode, 'display', 'none');
- this.editPane = this._makeClonePane(this.getItem(row), row, done, done);
+ this.editPane = this._makeClonePane(this.getItem(row), row, postSubmit, done);
this.domNode.parentNode.insertBefore(this.editPane.domNode, this.domNode);
if(this.onEditPane) this.onEditPane(this.editPane);
},
More information about the open-ils-commits
mailing list