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

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Feb 5 12:53:08 EST 2009


Author: erickson
Date: 2009-02-05 12:53:05 -0500 (Thu, 05 Feb 2009)
New Revision: 12083

Modified:
   trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
Log:
consistent focus handling after user clicks cancel/save in edit dialog.  still funky when same actions are done from the create dialog

Modified: trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js	2009-02-05 17:52:24 UTC (rev 12082)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js	2009-02-05 17:53:05 UTC (rev 12083)
@@ -54,6 +54,12 @@
                     this.selection.select(this.focus.rowIndex);
                 };
 
+                dojo.connect(this, 'onRowDblClick',
+                    function(e) {
+                        this._drawEditDialog(this.selection.getFirstSelected(), this.focus.rowIndex);
+                    }
+                );
+
                 dojo.connect(this, 'onKeyDown',
                     function(e) {
                         if(e.keyCode == dojo.keys.ENTER) {
@@ -78,8 +84,13 @@
                                 continue; // don't try to edit an identifier field
                             grid.store.setValue(storeItem, field, fmObject[field]());
                         }
-                        grid.update();
                         dialog.destroy();
+                        setTimeout(function(){
+                            grid.views.views[1].getCellNode(rowIndex, 0).focus();},200);
+                    },
+                    onCancel : function() {
+                        setTimeout(function(){
+                            grid.views.views[1].getCellNode(rowIndex, 0).focus();},200);
                     }
                 });
                 dialog.editPane.fieldOrder = this.fieldOrder;
@@ -94,12 +105,14 @@
                     fmClass : this.fmClass,
                     onPostSubmit : function(r) {
                         var fmObject = openils.Util.readResponse(r);
-                        if(fmObject) {
+                        if(fmObject) 
                             grid.store.newItem(fmObject.toStoreItem());
-                            grid.update();
-                        }
                         dialog.destroy();
-                    }
+                        setTimeout(function(){
+                            grid.selection.select(grid.rowCount-1);
+                            grid.views.views[1].getCellNode(grid.rowCount-1, 1).focus();
+                        },200);
+                    },
                 });
                 dialog.editPane.fieldOrder = this.fieldOrder;
                 dialog.editPane.mode = 'create';



More information about the open-ils-commits mailing list