[open-ils-commits] r12067 - trunk/Open-ILS/web/js/dojo/openils/widget

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Feb 4 16:27:49 EST 2009


Author: erickson
Date: 2009-02-04 16:27:44 -0500 (Wed, 04 Feb 2009)
New Revision: 12067

Modified:
   trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
Log:
rely on the stored grid data to reconstitute a fm object for building the edit dialog

Modified: trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js	2009-02-04 21:11:29 UTC (rev 12066)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js	2009-02-04 21:27:44 UTC (rev 12067)
@@ -14,10 +14,6 @@
             /* if true, pop up an edit dialog when user hits Enter on a give row */
             editOnEnter : false, 
 
-            /* maps dojo store items to fieldmapper objects, since the 
-             * grid may not have access to all fm objects */
-            storeItemObjectMapper : null,  
-
             startup : function() {
                 this.inherited(arguments);
                 this.initAutoEnv();
@@ -42,6 +38,8 @@
 
             /* capture keydown and launch edit dialog on enter */
             _applyEditOnEnter : function() {
+                this.onMouseOverRow = function(e) {};
+                this.onMouseOut = function(e) {};
                 dojo.connect(this, 'onKeyDown',
                     function(e) {
                         if(e.keyCode == dojo.keys.ENTER) {
@@ -55,18 +53,19 @@
 
             _drawEditDialog : function(storeItem) {
                 var grid = this;
-                var fmObject = this.storeItemObjectMapper(storeItem);
+                var fmObject = new fieldmapper[this.fmClass]().fromStoreItem(storeItem);
                 var idents = grid.store.getIdentityAttributes();
                 var dialog = new openils.widget.EditDialog({
                     fmObject:fmObject,
                     onPostApply : function() {
-                        // update the grid store
                         for(var i in fmObject._fields) {
                             var field = fmObject._fields[i];
                             if(idents.filter(function(j){return (j == field)})[0])
                                 continue; // don't try to edit an identifier field
                             grid.store.setValue(storeItem, field, fmObject[field]());
                         }
+                        grid.update();
+                        dialog.destroy();
                     }
                 });
                 dialog.editPane.fieldOrder = this.fieldOrder;



More information about the open-ils-commits mailing list