* editing that cell.</p>
*/
clicksToEdit: 2,
-
+
<div id="cfg-Ext.grid.EditorGridPanel-forceValidation"></div>/**
* @cfg {Boolean} forceValidation
* True to force validation even if the value is unmodified (defaults to false)
// private
detectEdit: false,
- <div id="cfg-Ext.grid.EditorGridPanel-autoEncode"></div>/**
- * @cfg {Boolean} autoEncode
- * True to automatically HTML encode and decode values pre and post edit (defaults to false)
- */
- autoEncode : false,
+ <div id="cfg-Ext.grid.EditorGridPanel-autoEncode"></div>/**
+ * @cfg {Boolean} autoEncode
+ * True to automatically HTML encode and decode values pre and post edit (defaults to false)
+ */
+ autoEncode : false,
- <div id="cfg-Ext.grid.EditorGridPanel-trackMouseOver"></div>/**
- * @cfg {Boolean} trackMouseOver @hide
- */
+ <div id="cfg-Ext.grid.EditorGridPanel-trackMouseOver"></div>/**
+ * @cfg {Boolean} trackMouseOver @hide
+ */
// private
trackMouseOver: false, // causes very odd FF errors
this.activeEditor = null;
- this.addEvents(
+ this.addEvents(
<div id="event-Ext.grid.EditorGridPanel-beforeedit"></div>/**
* @event beforeedit
* Fires before cell editing is triggered. The edit event object has the following properties <br />
* <li>column - The grid column index</li>
* </ul>
*
- * <pre><code>
+ * <pre><code>
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();
-};
+};
* </code></pre>
* @param {Object} e An edit event (see above for description)
*/
* 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:
- * <pre><code>
+ * <pre><code>
grid.on('validateedit', function(e) {
var myTargetRow = 6;
-
+
if (e.row == myTargetRow) {
e.cancel = true;
e.record.data[e.field] = e.value;
this.on('celldblclick', this.onCellDblClick, this);
}
},
-
+
onResize : function(){
Ext.grid.EditorGridPanel.superclass.onResize.apply(this, arguments);
var ae = this.activeEditor;
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)){
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);
}
}
},
},
// 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;
+ },
<div id="method-Ext.grid.EditorGridPanel-stopEditing"></div>/**
* Stops any active editing
*/
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);