can now specify post update and create handlers. wrap re-focus in try
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 9 Feb 2009 18:47:25 +0000 (18:47 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 9 Feb 2009 18:47:25 +0000 (18:47 +0000)
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

index 4e715f5..adb4a71 100644 (file)
@@ -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);
                     },
                 });