Upgrade to ExtJS 3.3.1 - Released 11/30/2010
[extjs.git] / examples / docs / source / SpinnerField.html
1 <html>
2 <head>
3   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
4   <title>The source code</title>
5     <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6     <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 </head>
8 <body  onload="prettyPrint();">
9     <pre class="prettyprint lang-js">/*!
10  * Ext JS Library 3.3.1
11  * Copyright(c) 2006-2010 Sencha Inc.
12  * licensing@sencha.com
13  * http://www.sencha.com/license
14  */
15 Ext.ns('Ext.ux.form');
16
17 <div id="cls-Ext.ux.form.SpinnerField"></div>/**
18  * @class Ext.ux.form.SpinnerField
19  * @extends Ext.form.NumberField
20  * Creates a field utilizing Ext.ux.Spinner
21  * @xtype spinnerfield
22  */
23 Ext.ux.form.SpinnerField = Ext.extend(Ext.form.NumberField, {
24     actionMode: 'wrap',
25     deferHeight: true,
26     autoSize: Ext.emptyFn,
27     onBlur: Ext.emptyFn,
28     adjustSize: Ext.BoxComponent.prototype.adjustSize,
29
30         constructor: function(config) {
31                 var spinnerConfig = Ext.copyTo({}, config, 'incrementValue,alternateIncrementValue,accelerate,defaultValue,triggerClass,splitterClass');
32
33                 var spl = this.spinner = new Ext.ux.Spinner(spinnerConfig);
34
35                 var plugins = config.plugins
36                         ? (Ext.isArray(config.plugins)
37                                 ? config.plugins.push(spl)
38                                 : [config.plugins, spl])
39                         : spl;
40
41                 Ext.ux.form.SpinnerField.superclass.constructor.call(this, Ext.apply(config, {plugins: plugins}));
42         },
43
44     // private
45     getResizeEl: function(){
46         return this.wrap;
47     },
48
49     // private
50     getPositionEl: function(){
51         return this.wrap;
52     },
53
54     // private
55     alignErrorIcon: function(){
56         if (this.wrap) {
57             this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]);
58         }
59     },
60
61     validateBlur: function(){
62         return true;
63     }
64 });
65
66 Ext.reg('spinnerfield', Ext.ux.form.SpinnerField);
67
68 //backwards compat
69 Ext.form.SpinnerField = Ext.ux.form.SpinnerField;
70 </pre>    
71 </body>
72 </html>