From 5d45a06f93bec4dcdbac553a950499f6dd22cf32 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 9 Feb 2009 18:47:25 +0000 Subject: [PATCH] can now specify post update and create handlers. wrap re-focus in try git-svn-id: svn://svn.open-ils.org/ILS/trunk@12120 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/dojo/openils/widget/AutoGrid.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js index 4e715f58b5..adb4a71d38 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js @@ -85,8 +85,17 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { grid.store.setValue(storeItem, field, fmObject[field]()); } dialog.destroy(); - setTimeout(function(){ - grid.views.views[0].getCellNode(rowIndex, 0).focus();},200); + + if(self.onPostUpdate) + self.onPostUpdate(storeItem, rowIndex); + + setTimeout( + function(){ + try { + grid.views.views[0].getCellNode(rowIndex, 0).focus(); + } catch (E) {} + },200 + ); }, onCancel : function() { setTimeout(function(){ @@ -108,9 +117,13 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { if(fmObject) grid.store.newItem(fmObject.toStoreItem()); dialog.destroy(); + if(grid.onPostCreate) + grid.onPostCreate(fmObject); setTimeout(function(){ - grid.selection.select(grid.rowCount-1); - grid.views.views[0].getCellNode(grid.rowCount-1, 1).focus(); + try { + grid.selection.select(grid.rowCount-1); + grid.views.views[0].getCellNode(grid.rowCount-1, 1).focus(); + } catch (E) {} },200); }, }); -- 2.11.0