From: erickson Date: Wed, 4 Feb 2009 21:27:44 +0000 (+0000) Subject: rely on the stored grid data to reconstitute a fm object for building the edit dialog X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ecdc37c6d3750d1d2e9d118b8813fc2f6bf9147b;p=evergreen%2Ftadl.git rely on the stored grid data to reconstitute a fm object for building the edit dialog git-svn-id: svn://svn.open-ils.org/ILS/trunk@12067 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js index 0fab1bc5de..4d95cd4bc6 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js @@ -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;