Upgrade to ExtJS 4.0.2 - Released 06/09/2011
[extjs.git] / docs / source / CellEditor.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5   <title>The source code</title>
6   <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7   <script type="text/javascript" src="../prettify/prettify.js"></script>
8   <style type="text/css">
9     .highlight { display: block; background-color: #ddd; }
10   </style>
11   <script type="text/javascript">
12     function highlight() {
13       document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
14     }
15   </script>
16 </head>
17 <body onload="prettyPrint(); highlight();">
18   <pre class="prettyprint lang-js"><span id='Ext-grid-CellEditor'>/**
19 </span> * @class Ext.grid.CellEditor
20  * @extends Ext.Editor
21  * Internal utility class that provides default configuration for cell editing.
22  * @ignore
23  */
24 Ext.define('Ext.grid.CellEditor', {
25     extend: 'Ext.Editor',
26     constructor: function(config) {
27         config = Ext.apply({}, config);
28         
29         if (config.field) {
30             config.field.monitorTab = false;
31         }
32         if (!Ext.isDefined(config.autoSize)) {
33             config.autoSize = {
34                 width: 'boundEl'
35             };
36         }
37         this.callParent([config]);
38     },
39     
40 <span id='Ext-grid-CellEditor-method-onShow'>    /**
41 </span>     * @private
42      * Hide the grid cell when editor is shown.
43      */
44     onShow: function() {
45         var first = this.boundEl.first();
46         if (first) {
47             first.hide();
48         }
49         this.callParent(arguments);
50     },
51     
52 <span id='Ext-grid-CellEditor-method-onHide'>    /**
53 </span>     * @private
54      * Show grid cell when editor is hidden.
55      */
56     onHide: function() {
57         var first = this.boundEl.first();
58         if (first) {
59             first.show();
60         }
61         this.callParent(arguments);
62     },
63     
64 <span id='Ext-grid-CellEditor-method-afterRender'>    /**
65 </span>     * @private
66      * Fix checkbox blur when it is clicked.
67      */
68     afterRender: function() {
69         this.callParent(arguments);
70         var field = this.field;
71         if (field.isXType('checkboxfield')) {
72             field.mon(field.inputEl, 'mousedown', this.onCheckBoxMouseDown, this);
73             field.mon(field.inputEl, 'click', this.onCheckBoxClick, this);
74         }
75     },
76     
77 <span id='Ext-grid-CellEditor-method-onCheckBoxMouseDown'>    /**
78 </span>     * @private
79      * Because when checkbox is clicked it loses focus  completeEdit is bypassed.
80      */
81     onCheckBoxMouseDown: function() {
82         this.completeEdit = Ext.emptyFn;
83     },
84     
85 <span id='Ext-grid-CellEditor-method-onCheckBoxClick'>    /**
86 </span>     * @private
87      * Restore checkbox focus and completeEdit method.
88      */
89     onCheckBoxClick: function() {
90         delete this.completeEdit;
91         this.field.focus(false, 10);
92     },
93     
94     alignment: &quot;tl-tl&quot;,
95     hideEl : false,
96     cls: Ext.baseCSSPrefix + &quot;small-editor &quot; + Ext.baseCSSPrefix + &quot;grid-editor&quot;,
97     shim: false,
98     shadow: false
99 });</pre>
100 </body>
101 </html>