[open-ils-commits] r12344 - trunk/Open-ILS/web/js/dojo/openils/widget (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Mar 2 10:41:07 EST 2009


Author: erickson
Date: 2009-03-02 10:41:04 -0500 (Mon, 02 Mar 2009)
New Revision: 12344

Modified:
   trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
Log:
implemented 'clone selected row'

Modified: trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js	2009-03-02 15:40:38 UTC (rev 12343)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js	2009-03-02 15:41:04 UTC (rev 12344)
@@ -189,7 +189,26 @@
                 return pane;
             },
 
+            // .startup() is called within
+            _makeClonePane : function(storeItem, rowIndex, onPostSubmit, onCancel) {
+                var clonePane = this._makeCreatePane(onPostSubmit, onCancel);
+                var origPane = this._makeEditPane(this.selection.getFirstSelected(), this.focus.rowIndex);
+                clonePane.startup();
+                origPane.startup();
+                dojo.forEach(origPane.fieldList,
+                    function(field) {
+                        if(field.widget.widget.attr('disabled')) return;
+                        var w = clonePane.fieldList.filter(
+                            function(i) { return (i.name == field.name) })[0];
+                        w.widget.baseWidgetValue(field.widget.widgetValue); // sync widgets
+                        w.widget.onload = function(){w.widget.baseWidgetValue(field.widget.widgetValue)}; // async widgets
+                    }
+                );
+                origPane.destroy();
+                return clonePane;
+            },
 
+
             _drawEditDialog : function(storeItem, rowIndex) {
                 var self = this;
                 var done = function() { self.hideDialog(); };
@@ -217,6 +236,14 @@
                 dojo.style(this.domNode, 'display', 'none');
             },
 
+            showClonePane : function(storeItem, rowIndex) {
+                var self = this;
+                var done = function() { self.hidePane(); };
+                this.editPane = this._makeClonePane(storeItem, rowIndex, done, done);
+                this.domNode.parentNode.insertBefore(this.editPane.domNode, this.domNode);
+                dojo.style(this.domNode, 'display', 'none');
+            },
+
             showCreatePane : function() {
                 var self = this;
                 var done = function() { self.hidePane(); };



More information about the open-ils-commits mailing list