rely on the stored grid data to reconstitute a fm object for building the edit dialog
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 4 Feb 2009 21:27:44 +0000 (21:27 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 4 Feb 2009 21:27:44 +0000 (21:27 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12067 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/widget/AutoGrid.js

index 0fab1bc..4d95cd4 100644 (file)
@@ -14,10 +14,6 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
             /* 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 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
 
             /* 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 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
 
             _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;