<!DOCTYPE html>
|
<html>
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<title>The source code</title>
|
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
|
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
|
<style type="text/css">
|
.highlight { display: block; background-color: #ddd; }
|
</style>
|
<script type="text/javascript">
|
function highlight() {
|
document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
|
}
|
</script>
|
</head>
|
<body onload="prettyPrint(); highlight();">
|
<pre class="prettyprint lang-js"><span id='Ext-grid-CellEditor'>/**
|
</span> * Internal utility class that provides default configuration for cell editing.
|
* @private
|
*/
|
Ext.define('Ext.grid.CellEditor', {
|
extend: 'Ext.Editor',
|
<span id='Ext-grid-CellEditor-method-constructor'> constructor: function(config) {
|
</span> config = Ext.apply({}, config);
|
|
if (config.field) {
|
config.field.monitorTab = false;
|
}
|
this.callParent([config]);
|
},
|
|
<span id='Ext-grid-CellEditor-method-onShow'> /**
|
</span> * @private
|
* Hides the grid cell inner element when a cell editor is shown.
|
*/
|
onShow: function() {
|
var me = this,
|
innerCell = me.boundEl.first();
|
|
if (innerCell) {
|
if (me.isForTree) {
|
innerCell = innerCell.child(me.treeNodeSelector);
|
}
|
innerCell.hide();
|
}
|
|
me.callParent(arguments);
|
},
|
|
<span id='Ext-grid-CellEditor-method-onHide'> /**
|
</span> * @private
|
* Shows the grid cell inner element when a cell editor is hidden
|
*/
|
onHide: function() {
|
var me = this,
|
innerCell = me.boundEl.first();
|
|
if (innerCell) {
|
if (me.isForTree) {
|
innerCell = innerCell.child(me.treeNodeSelector);
|
}
|
innerCell.show();
|
}
|
|
me.callParent(arguments);
|
},
|
|
<span id='Ext-grid-CellEditor-method-afterRender'> /**
|
</span> * @private
|
* Fix checkbox blur when it is clicked.
|
*/
|
afterRender: function() {
|
var me = this,
|
field = me.field;
|
|
me.callParent(arguments);
|
if (field.isCheckbox) {
|
field.mon(field.inputEl, {
|
mousedown: me.onCheckBoxMouseDown,
|
click: me.onCheckBoxClick,
|
scope: me
|
});
|
}
|
},
|
|
<span id='Ext-grid-CellEditor-method-onCheckBoxMouseDown'> /**
|
</span> * @private
|
* Because when checkbox is clicked it loses focus completeEdit is bypassed.
|
*/
|
onCheckBoxMouseDown: function() {
|
this.completeEdit = Ext.emptyFn;
|
},
|
|
<span id='Ext-grid-CellEditor-method-onCheckBoxClick'> /**
|
</span> * @private
|
* Restore checkbox focus and completeEdit method.
|
*/
|
onCheckBoxClick: function() {
|
delete this.completeEdit;
|
this.field.focus(false, 10);
|
},
|
|
<span id='Ext-grid-CellEditor-method-realign'> /**
|
</span> * @private
|
* Realigns the Editor to the grid cell, or to the text node in the grid inner cell
|
* if the inner cell contains multiple child nodes.
|
*/
|
realign: function(autoSize) {
|
var me = this,
|
boundEl = me.boundEl,
|
innerCell = boundEl.first(),
|
width = boundEl.getWidth(),
|
offsets = Ext.Array.clone(me.offsets),
|
grid = me.grid,
|
xOffset;
|
|
if (me.isForTree) {
|
// When editing a tree, adjust the width and offsets of the editor to line
|
// up with the tree cell's text element
|
xOffset = me.getTreeNodeOffset(innerCell);
|
width -= Math.abs(xOffset);
|
offsets[0] += xOffset;
|
}
|
|
if (grid.columnLines) {
|
// Subtract the column border width so that the editor displays inside the
|
// borders. The column border could be either on the left or the right depending
|
// on whether the grid is RTL - using the sum of both borders works in both modes.
|
width -= boundEl.getBorderWidth('rl');
|
}
|
|
if (autoSize === true) {
|
me.field.setWidth(width);
|
}
|
|
me.alignTo(innerCell, me.alignment, offsets);
|
},
|
|
<span id='Ext-grid-CellEditor-method-getTreeNodeOffset'> // private
|
</span> getTreeNodeOffset: function(innerCell) {
|
return innerCell.child(this.treeNodeSelector).getOffsetsTo(innerCell)[0];
|
},
|
|
<span id='Ext-grid-CellEditor-method-onEditorTab'> onEditorTab: function(e){
|
</span> var field = this.field;
|
if (field.onEditorTab) {
|
field.onEditorTab(e);
|
}
|
},
|
|
<span id='Ext-grid-CellEditor-cfg-alignment'> alignment: "l-l",
|
</span><span id='Ext-grid-CellEditor-cfg-hideEl'> hideEl : false,
|
</span><span id='Ext-grid-CellEditor-cfg-cls'> cls: Ext.baseCSSPrefix + 'small-editor ' +
|
</span> Ext.baseCSSPrefix + 'grid-editor ' +
|
Ext.baseCSSPrefix + 'grid-cell-editor',
|
<span id='Ext-grid-CellEditor-property-treeNodeSelector'> treeNodeSelector: '.' + Ext.baseCSSPrefix + 'tree-node-text',
|
</span><span id='Ext-grid-CellEditor-property-shim'> shim: false,
|
</span><span id='Ext-grid-CellEditor-cfg-shadow'> shadow: false
|
</span>});</pre>
|
</body>
|
</html>
|