roojs-ui-debug.js
authorAlan Knowles <alan@akbkhome.com>
Tue, 6 Dec 2011 07:43:21 +0000 (15:43 +0800)
committerAlan Knowles <alan@akbkhome.com>
Tue, 6 Dec 2011 07:43:21 +0000 (15:43 +0800)
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-all.js
roojs-debug.js

roojs-all.js
roojs-debug.js

index 24f5c35..b5d594b 100644 (file)
@@ -950,9 +950,9 @@ this.last=false;},selectAll:function(){if(this.locked)return;this.selections.cle
 this.fireEvent("afterselectionchange",this);},handleDragableRowClick:function(A,B,e){if(e.button===0&&!e.shiftKey&&!e.ctrlKey){this.selectRow(B,false);A.view.focusRow(B);this.fireEvent("afterselectionchange",this);}},selectRows:function(A,B){if(!B){this.clearSelections();}for(var i=0,C=A.length;i<C;i++){this.selectRow(A[i],true);}},selectRange:function(A,B,C){if(this.locked)return;if(!C){this.clearSelections();}if(A<=B){for(var i=A;i<=B;i++){this.selectRow(i,true);}}else {for(var i=A;i>=B;i--){this.selectRow(i,true);}}},deselectRange:function(A,B,C){if(this.locked)return;for(var i=A;i<=B;i++){this.deselectRow(i,C);}},selectRow:function(A,B,C){if(this.locked||(A<0||A>=this.grid.dataSource.getCount()))return;if(this.fireEvent("beforerowselect",this,A,B)!==false){if(!B||this.singleSelect){this.clearSelections();}var r=this.grid.dataSource.getAt(A);this.selections.add(r);this.last=this.lastActive=A;if(!C){this.grid.getView().onRowSelect(A);}
 this.fireEvent("rowselect",this,A,r);this.fireEvent("selectionchange",this);}},deselectRow:function(A,B){if(this.locked)return;if(this.last==A){this.last=false;}if(this.lastActive==A){this.lastActive=false;}var r=this.grid.dataSource.getAt(A);this.selections.remove(r);if(!B){this.grid.getView().onRowDeselect(A);}
 this.fireEvent("rowdeselect",this,A);this.fireEvent("selectionchange",this);},restoreLast:function(){if(this._last){this.last=this._last;}},acceptsNav:function(A,B,cm){return !cm.isHidden(B)&&cm.isCellEditable(B,A);},onEditorKey:function(A,e){var k=e.getKey(),B,g=this.grid,ed=g.activeEditor;if(k==e.TAB){e.stopEvent();ed.completeEdit();if(e.shiftKey){B=g.walkCells(ed.row,ed.col-1,-1,this.acceptsNav,this);}else {B=g.walkCells(ed.row,ed.col+1,1,this.acceptsNav,this);}}else if(k==e.ENTER&&!e.ctrlKey){e.stopEvent();ed.completeEdit();if(e.shiftKey){B=g.walkCells(ed.row-1,ed.col,-1,this.acceptsNav,this);}else {B=g.walkCells(ed.row+1,ed.col,1,this.acceptsNav,this);}}else if(k==e.ESC){ed.cancelEdit();}if(B){g.startEditing(B[0],B[1]);}}});
-Roo.grid.CellSelectionModel=function(A){Roo.apply(this,A);this.selection=null;this.addEvents({"beforecellselect":true,"cellselect":true,"selectionchange":true});Roo.grid.CellSelectionModel.superclass.constructor.call(this);};Roo.extend(Roo.grid.CellSelectionModel,Roo.grid.AbstractSelectionModel,{initEvents:function(){this.grid.on("mousedown",this.handleMouseDown,this);this.grid.getGridEl().on(Roo.isIE?"keydown":"keypress",this.handleKeyDown,this);var A=this.grid.view;A.on("refresh",this.onViewChange,this);A.on("rowupdated",this.onRowUpdated,this);A.on("beforerowremoved",this.clearSelections,this);A.on("beforerowsinserted",this.clearSelections,this);if(this.grid.isEditor){this.grid.on("beforeedit",this.beforeEdit,this);}},beforeEdit:function(e){this.select(e.row,e.column,false,true,e.record);},onRowUpdated:function(v,A,r){if(this.selection&&this.selection.record==r){v.onCellSelect(A,this.selection.cell[1]);}},onViewChange:function(){this.clearSelections(true);},getSelectedCell:function(){return this.selection?this.selection.cell:null;},clearSelections:function(A){var s=this.selection;if(s){if(A!==true){this.grid.view.onCellDeselect(s.cell[0],s.cell[1]);}
+Roo.grid.CellSelectionModel=function(A){Roo.apply(this,A);this.selection=null;this.addEvents({"beforecellselect":true,"cellselect":true,"selectionchange":true,"tabend":true});Roo.grid.CellSelectionModel.superclass.constructor.call(this);};Roo.extend(Roo.grid.CellSelectionModel,Roo.grid.AbstractSelectionModel,{enter_is_tab:false,initEvents:function(){this.grid.on("mousedown",this.handleMouseDown,this);this.grid.getGridEl().on(Roo.isIE?"keydown":"keypress",this.handleKeyDown,this);var A=this.grid.view;A.on("refresh",this.onViewChange,this);A.on("rowupdated",this.onRowUpdated,this);A.on("beforerowremoved",this.clearSelections,this);A.on("beforerowsinserted",this.clearSelections,this);if(this.grid.isEditor){this.grid.on("beforeedit",this.beforeEdit,this);}},beforeEdit:function(e){this.select(e.row,e.column,false,true,e.record);},onRowUpdated:function(v,A,r){if(this.selection&&this.selection.record==r){v.onCellSelect(A,this.selection.cell[1]);}},onViewChange:function(){this.clearSelections(true);},getSelectedCell:function(){return this.selection?this.selection.cell:null;},clearSelections:function(A){var s=this.selection;if(s){if(A!==true){this.grid.view.onCellDeselect(s.cell[0],s.cell[1]);}
 this.selection=null;this.fireEvent("selectionchange",this,null);}},hasSelection:function(){return this.selection?true:false;},handleMouseDown:function(e,t){var v=this.grid.getView();if(this.isLocked()){return;};var A=v.findRowIndex(t);var B=v.findCellIndex(t);if(A!==false&&B!==false){this.select(A,B);}},select:function(A,B,C,D,r){if(this.fireEvent("beforecellselect",this,A,B)!==false){this.clearSelections();r=r||this.grid.dataSource.getAt(A);this.selection={record:r,cell:[A,B]};if(!C){var v=this.grid.getView();v.onCellSelect(A,B);if(D!==true){v.focusCell(A,B);}}
-this.fireEvent("cellselect",this,A,B);this.fireEvent("selectionchange",this,this.selection);}},isSelectable:function(A,B,cm){return !cm.isHidden(B);},handleKeyDown:function(e){if(!e.isNavKeyPress()){return;}var g=this.grid,s=this.selection;if(!s){e.stopEvent();var A=g.walkCells(0,0,1,this.isSelectable,this);if(A){this.select(A[0],A[1]);}return;}var sm=this;var B=function(D,E,F){return g.walkCells(D,E,F,sm.isSelectable,sm);};var k=e.getKey(),r=s.cell[0],c=s.cell[1];var C;switch(k){case e.TAB:if(g.isEditor&&g.editing){return;}if(e.shiftKey){C=B(r,c-1,-1);}else {C=B(r,c+1,1);}break;case e.DOWN:C=B(r+1,c,1);break;case e.UP:C=B(r-1,c,-1);break;case e.RIGHT:C=B(r,c+1,1);break;case e.LEFT:C=B(r,c-1,-1);break;case e.ENTER:if(g.isEditor&&!g.editing){g.startEditing(r,c);e.stopEvent();return;}break;};if(C){this.select(C[0],C[1]);e.stopEvent();}},acceptsNav:function(A,B,cm){return !cm.isHidden(B)&&cm.isCellEditable(B,A);},onEditorKey:function(A,e){var k=e.getKey(),B,g=this.grid,ed=g.activeEditor;if(!ed){}if(k==e.TAB){if(e.shiftKey){B=g.walkCells(ed.row,ed.col-1,-1,this.acceptsNav,this);}else {B=g.walkCells(ed.row,ed.col+1,1,this.acceptsNav,this);}
+this.fireEvent("cellselect",this,A,B);this.fireEvent("selectionchange",this,this.selection);}},isSelectable:function(A,B,cm){return !cm.isHidden(B);},handleKeyDown:function(e){if(!e.isNavKeyPress()){return;}var g=this.grid,s=this.selection;if(!s){e.stopEvent();var A=g.walkCells(0,0,1,this.isSelectable,this);if(A){this.select(A[0],A[1]);}return;}var sm=this;var B=function(E,F,G){return g.walkCells(E,F,G,sm.isSelectable,sm);};var k=e.getKey(),r=s.cell[0],c=s.cell[1];var C,D=false;if(this.enter_is_tab&&k==e.ENTER){k=e.TAB;}switch(k){case e.TAB:if(g.isEditor&&g.editing){return;}if(e.shiftKey){C=B(r,c-1,-1);}else {C=B(r,c+1,1);D=true;}break;case e.DOWN:C=B(r+1,c,1);D=true;break;case e.UP:C=B(r-1,c,-1);break;case e.RIGHT:C=B(r,c+1,1);D=true;break;case e.LEFT:C=B(r,c-1,-1);break;case e.ENTER:if(g.isEditor&&!g.editing){g.startEditing(r,c);e.stopEvent();return;}break;};if(C){this.select(C[0],C[1]);e.stopEvent();}else if(D){this.fireEvent('tabend',this);}},acceptsNav:function(A,B,cm){return !cm.isHidden(B)&&cm.isCellEditable(B,A);},onEditorKey:function(A,e){var k=e.getKey(),B,g=this.grid,ed=g.activeEditor;if(!ed){}if(k==e.TAB){if(e.shiftKey){B=g.walkCells(ed.row,ed.col-1,-1,this.acceptsNav,this);}else {B=g.walkCells(ed.row,ed.col+1,1,this.acceptsNav,this);}
 e.stopEvent();}else if(k==e.ENTER&&!e.ctrlKey){ed.completeEdit();e.stopEvent();B=g.walkCells(ed.row,ed.col+1,1,this.acceptsNav,this);}else if(k==e.ESC){ed.cancelEdit();}if(B){g.startEditing.defer(100,g,[B[0],B[1]]);}}});
 Roo.grid.EditorGrid=function(A,B){Roo.grid.EditorGrid.superclass.constructor.call(this,A,B);this.getGridEl().addClass("xedit-grid");if(!this.selModel){this.selModel=new Roo.grid.CellSelectionModel();}
 this.activeEditor=null;this.addEvents({"beforeedit":true,"afteredit":true,"validateedit":true});this.on("bodyscroll",this.stopEditing,this);this.on(this.clicksToEdit==1?"cellclick":"celldblclick",this.onCellDblClick,this);};Roo.extend(Roo.grid.EditorGrid,Roo.grid.Grid,{clicksToEdit:2,isEditor:true,trackMouseOver:false,onCellDblClick:function(g,A,B){this.startEditing(A,B);},onEditComplete:function(ed,A,B){this.editing=false;this.activeEditor=null;ed.un("specialkey",this.selModel.onEditorKey,this.selModel);var r=ed.record;var C=this.colModel.getDataIndex(ed.col);var e={grid:this,record:r,field:C,originalValue:B,value:A,row:ed.row,column:ed.col,cancel:false,editor:ed};var D=Roo.get(this.view.getCell(ed.row,ed.col))
index ed41354..42e5de9 100644 (file)
@@ -11554,10 +11554,9 @@ Roo.Ajax = new Roo.data.Connection({
  */
  
 /**
+ * Global Ajax request class.
  * @class Roo.Ajax
  * @extends Roo.data.Connection
- * Global Ajax request class.
- *
  * @instanceOf  Roo.data.Connection
  */
 Roo.Ajax = new Roo.data.Connection({
@@ -51166,6 +51165,7 @@ Roo.extend(Roo.grid.RowSelectionModel, Roo.grid.AbstractSelectionModel,  {
  * This class provides the basic implementation for cell selection in a grid.
  * @constructor
  * @param {Object} config The object containing the configuration of this model.
+ * @cfg {Boolean} enter_is_tab Enter behaves the same as tab. (eg. goes to next cell) default: false
  */
 Roo.grid.CellSelectionModel = function(config){
     Roo.apply(this, config);
@@ -51199,12 +51199,21 @@ Roo.grid.CellSelectionModel = function(config){
                <li>o.cell: An array of [rowIndex, columnIndex]</li>
                </ul>
             */
-           "selectionchange" : true
+           "selectionchange" : true,
+        /**
+            * @event tabend
+            * Fires when the tab (or enter) was pressed on the last editable cell
+            * You can use this to trigger add new row.
+            * @param {SelectionModel} this
+            */
+           "tabend" : true
     });
     Roo.grid.CellSelectionModel.superclass.constructor.call(this);
 };
 
 Roo.extend(Roo.grid.CellSelectionModel, Roo.grid.AbstractSelectionModel,  {
+    
+    enter_is_tab: false,
 
     /** @ignore */
     initEvents : function(){
@@ -51331,7 +51340,11 @@ Roo.extend(Roo.grid.CellSelectionModel, Roo.grid.AbstractSelectionModel,  {
             return g.walkCells(row, col, step, sm.isSelectable,  sm);
         };
         var k = e.getKey(), r = s.cell[0], c = s.cell[1];
-        var newCell;
+        var newCell, forward=false;
+
+        if (this.enter_is_tab && k == e.ENTER) {
+            k = e.TAB;
+        }
 
         switch(k){
             case e.TAB:
@@ -51339,35 +51352,50 @@ Roo.extend(Roo.grid.CellSelectionModel, Roo.grid.AbstractSelectionModel,  {
                 if (g.isEditor && g.editing) {
                     return;
                 }
-                if(e.shiftKey){
-                     newCell = walk(r, c-1, -1);
-                }else{
-                     newCell = walk(r, c+1, 1);
+                if(e.shiftKey) {
+                    newCell = walk(r, c-1, -1);
+                } else {
+                    newCell = walk(r, c+1, 1);
+                    forward = true;
                 }
-             break;
-             case e.DOWN:
-                 newCell = walk(r+1, c, 1);
-             break;
-             case e.UP:
-                 newCell = walk(r-1, c, -1);
-             break;
-             case e.RIGHT:
-                 newCell = walk(r, c+1, 1);
-             break;
-             case e.LEFT:
-                 newCell = walk(r, c-1, -1);
-             break;
-             case e.ENTER:
-                 if(g.isEditor && !g.editing){
-                    g.startEditing(r, c);
-                    e.stopEvent();
-                    return;
+                break;
+            
+            case e.DOWN:
+               newCell = walk(r+1, c, 1);
+                forward = true;
+                break;
+            
+            case e.UP:
+                newCell = walk(r-1, c, -1);
+                break;
+            
+            case e.RIGHT:
+                newCell = walk(r, c+1, 1);
+                forward = true;
+                break;
+            
+            case e.LEFT:
+                newCell = walk(r, c-1, -1);
+                break;
+            
+            case e.ENTER:
+                
+                if(g.isEditor && !g.editing){
+                   g.startEditing(r, c);
+                   e.stopEvent();
+                   return;
                 }
+                
+                
              break;
         };
         if(newCell){
             this.select(newCell[0], newCell[1]);
             e.stopEvent();
+            
+        } else if (forward) {
+            // tabbed past last
+            this.fireEvent('tabend',this);
         }
     },