Upgrade to ExtJS 4.0.1 - Released 05/18/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         if (config.field) {
28             config.field.monitorTab = false;
29         }
30         config.autoSize = {
31             width: 'boundEl'
32         };
33         this.callParent(arguments);
34     },
35     
36 <span id='Ext-grid-CellEditor-method-onShow'>    /**
37 </span>     * @private
38      * Hide the grid cell when editor is shown.
39      */
40     onShow: function() {
41         var first = this.boundEl.first();
42         if (first) {
43             first.hide();
44         }
45         this.callParent(arguments);
46     },
47     
48 <span id='Ext-grid-CellEditor-method-onHide'>    /**
49 </span>     * @private
50      * Show grid cell when editor is hidden.
51      */
52     onHide: function() {
53         var first = this.boundEl.first();
54         if (first) {
55             first.show();
56         }
57         this.callParent(arguments);
58     },
59     
60 <span id='Ext-grid-CellEditor-method-afterRender'>    /**
61 </span>     * @private
62      * Fix checkbox blur when it is clicked.
63      */
64     afterRender: function() {
65         this.callParent(arguments);
66         var field = this.field;
67         if (field.isXType('checkboxfield')) {
68             field.mon(field.inputEl, 'mousedown', this.onCheckBoxMouseDown, this);
69             field.mon(field.inputEl, 'click', this.onCheckBoxClick, this);
70         }
71     },
72     
73 <span id='Ext-grid-CellEditor-method-onCheckBoxMouseDown'>    /**
74 </span>     * @private
75      * Because when checkbox is clicked it loses focus  completeEdit is bypassed.
76      */
77     onCheckBoxMouseDown: function() {
78         this.completeEdit = Ext.emptyFn;
79     },
80     
81 <span id='Ext-grid-CellEditor-method-onCheckBoxClick'>    /**
82 </span>     * @private
83      * Restore checkbox focus and completeEdit method.
84      */
85     onCheckBoxClick: function() {
86         delete this.completeEdit;
87         this.field.focus(false, 10);
88     },
89     
90     alignment: &quot;tl-tl&quot;,
91     hideEl : false,
92     cls: Ext.baseCSSPrefix + &quot;small-editor &quot; + Ext.baseCSSPrefix + &quot;grid-editor&quot;,
93     shim: false,
94     shadow: false
95 });</pre>
96 </body>
97 </html>