From 893cd427f725d91134cfff080dff3877db28cf06 Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 5 Feb 2009 17:53:05 +0000 Subject: [PATCH] consistent focus handling after user clicks cancel/save in edit dialog. still funky when same actions are done from the create dialog git-svn-id: svn://svn.open-ils.org/ILS/trunk@12083 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/dojo/openils/widget/AutoGrid.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js index b40e629ffe..2216d705a8 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js @@ -54,6 +54,12 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { 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 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { 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 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { 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'; -- 2.11.0