From b6eb8ef497b4024b351c00415d01396f52795e85 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 2 Mar 2009 15:41:04 +0000 Subject: [PATCH] implemented 'clone selected row' git-svn-id: svn://svn.open-ils.org/ILS/trunk@12344 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../web/js/dojo/openils/widget/AutoGrid.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js index 28d69fa72d..69942845f7 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js @@ -189,6 +189,25 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { 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; @@ -217,6 +236,14 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { 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(); }; -- 2.43.2