X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6e39d509471fe9b4e2660e0d1631b350d0c66f40..2e847cf21b8ab9d15fa167b315ca5b2fa92638fc:/pkgs/pkg-grid-editor-debug.js diff --git a/pkgs/pkg-grid-editor-debug.js b/pkgs/pkg-grid-editor-debug.js index 15ec1188..74aade1d 100644 --- a/pkgs/pkg-grid-editor-debug.js +++ b/pkgs/pkg-grid-editor-debug.js @@ -1,6 +1,6 @@ /*! - * Ext JS Library 3.1.0 - * Copyright(c) 2006-2009 Ext JS, LLC + * Ext JS Library 3.1.1 + * Copyright(c) 2006-2010 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license */ @@ -314,7 +314,7 @@ Ext.grid.EditorGridPanel = Ext.extend(Ext.grid.GridPanel, { * editing that cell.

*/ clicksToEdit: 2, - + /** * @cfg {Boolean} forceValidation * True to force validation even if the value is unmodified (defaults to false) @@ -326,15 +326,15 @@ Ext.grid.EditorGridPanel = Ext.extend(Ext.grid.GridPanel, { // private detectEdit: false, - /** - * @cfg {Boolean} autoEncode - * True to automatically HTML encode and decode values pre and post edit (defaults to false) - */ - autoEncode : false, + /** + * @cfg {Boolean} autoEncode + * True to automatically HTML encode and decode values pre and post edit (defaults to false) + */ + autoEncode : false, - /** - * @cfg {Boolean} trackMouseOver @hide - */ + /** + * @cfg {Boolean} trackMouseOver @hide + */ // private trackMouseOver: false, // causes very odd FF errors @@ -352,7 +352,7 @@ Ext.grid.EditorGridPanel = Ext.extend(Ext.grid.GridPanel, { this.activeEditor = null; - this.addEvents( + this.addEvents( /** * @event beforeedit * Fires before cell editing is triggered. The edit event object has the following properties
@@ -381,13 +381,13 @@ Ext.grid.EditorGridPanel = Ext.extend(Ext.grid.GridPanel, { *
  • column - The grid column index
  • * * - *
     
    +             * 
    
     grid.on('afteredit', afterEdit, this );
     
     function afterEdit(e) {
         // execute an XHR to send/commit data to the server, in callback do (if successful):
         e.record.commit();
    -}; 
    +};
                  * 
    * @param {Object} e An edit event (see above for description) */ @@ -410,10 +410,10 @@ function afterEdit(e) { * records (not all). By observing the grid's validateedit event, it can be cancelled if * the edit occurs on a targeted row (for example) and then setting the field's new value * in the Record directly: - *
     
    +             * 
    
     grid.on('validateedit', function(e) {
       var myTargetRow = 6;
    - 
    +
       if (e.row == myTargetRow) {
         e.cancel = true;
         e.record.data[e.field] = e.value;
    @@ -443,7 +443,7 @@ grid.on('validateedit', function(e) {
                 this.on('celldblclick', this.onCellDblClick, this);
             }
         },
    -    
    +
         onResize : function(){
             Ext.grid.EditorGridPanel.superclass.onResize.apply(this, arguments);
             var ae = this.activeEditor;
    @@ -483,8 +483,8 @@ grid.on('validateedit', function(e) {
         onEditComplete : function(ed, value, startValue){
             this.editing = false;
             this.activeEditor = null;
    -        
    -		var r = ed.record,
    +
    +        var r = ed.record,
                 field = this.colModel.getDataIndex(ed.col);
             value = this.postEditValue(value, startValue, r, field);
             if(this.forceValidation === true || String(value) !== String(startValue)){
    @@ -561,8 +561,16 @@ grid.on('validateedit', function(e) {
                         col: col
                     };
                     this.activeEditor = ed;
    +                // Set the selectSameEditor flag if we are reusing the same editor again and
    +                // need to prevent the editor from firing onBlur on itself.
    +                ed.selectSameEditor = (this.activeEditor == this.lastActiveEditor);
                     var v = this.preEditValue(r, field);
                     ed.startEdit(this.view.getCell(row, col).firstChild, Ext.isDefined(v) ? v : '');
    +
    +                // Clear the selectSameEditor flag
    +                (function(){
    +                    delete ed.selectSameEditor;
    +                }).defer(50);
                 }
             }
         },
    @@ -574,9 +582,9 @@ grid.on('validateedit', function(e) {
         },
     
         // private
    -	postEditValue : function(value, originalValue, r, field){
    -		return this.autoEncode && Ext.isString(value) ? Ext.util.Format.htmlEncode(value) : value;
    -	},
    +    postEditValue : function(value, originalValue, r, field){
    +        return this.autoEncode && Ext.isString(value) ? Ext.util.Format.htmlEncode(value) : value;
    +    },
     
         /**
          * Stops any active editing
    @@ -584,7 +592,8 @@ grid.on('validateedit', function(e) {
          */
         stopEditing : function(cancel){
             if(this.editing){
    -            var ae = this.activeEditor;
    +            // Store the lastActiveEditor to check if it is changing
    +            var ae = this.lastActiveEditor = this.activeEditor;
                 if(ae){
                     ae[cancel === true ? 'cancelEdit' : 'completeEdit']();
                     this.view.focusCell(ae.row, ae.col);