Roo/grid/CellSelectionModel.js
authorAlan Knowles <alan@akbkhome.com>
Tue, 6 Dec 2011 07:54:49 +0000 (15:54 +0800)
committerAlan Knowles <alan@akbkhome.com>
Tue, 6 Dec 2011 07:54:49 +0000 (15:54 +0800)
Roo/grid/CellSelectionModel.js

index 93daeeb..0205a7e 100644 (file)
@@ -191,9 +191,7 @@ Roo.extend(Roo.grid.CellSelectionModel, Roo.grid.AbstractSelectionModel,  {
         var k = e.getKey(), r = s.cell[0], c = s.cell[1];
         var newCell, forward=false;
 
-        if (this.enter_is_tab && k == e.ENTER) {
-            k = e.TAB;
-        }
+      
 
         switch(k){
             case e.TAB:
@@ -242,9 +240,6 @@ Roo.extend(Roo.grid.CellSelectionModel, Roo.grid.AbstractSelectionModel,  {
             this.select(newCell[0], newCell[1]);
             e.stopEvent();
             
-        } else if (forward) {
-            // tabbed past last
-            this.fireEvent('tabend',this);
         }
     },
 
@@ -263,18 +258,24 @@ Roo.extend(Roo.grid.CellSelectionModel, Roo.grid.AbstractSelectionModel,  {
      */
     onEditorKey : function(field, e){
         
-        var k = e.getKey(), newCell, g = this.grid, ed = g.activeEditor;
+        var k = e.getKey(),
+            newCell,
+            g = this.grid,
+            ed = g.activeEditor,
+            forward = false;
         ///Roo.log('onEditorKey' + k);
-        if (!ed) {
-            
-            
-            
+        
+        
+        if (this.enter_is_tab && k == e.ENTER) {
+            k = e.TAB;
         }
+        
         if(k == e.TAB){
             if(e.shiftKey){
                 newCell = g.walkCells(ed.row, ed.col-1, -1, this.acceptsNav, this);
             }else{
                 newCell = g.walkCells(ed.row, ed.col+1, 1, this.acceptsNav, this);
+                forward = true;
             }
             
             e.stopEvent();
@@ -291,6 +292,9 @@ Roo.extend(Roo.grid.CellSelectionModel, Roo.grid.AbstractSelectionModel,  {
         if(newCell){
             //Roo.log('next cell after edit');
             g.startEditing.defer(100, g, [newCell[0], newCell[1]]);
+        } else if (forward) {
+            // tabbed past last
+            this.fireEvent('tabend',this);
         }
     }
 });
\ No newline at end of file