1 | /*! |
---|
2 | * Ext JS Library 3.0.0 |
---|
3 | * Copyright(c) 2006-2009 Ext JS, LLC |
---|
4 | * licensing@extjs.com |
---|
5 | * http://www.extjs.com/license |
---|
6 | */ |
---|
7 | Ext.ns('Ext.ux.form'); |
---|
8 | |
---|
9 | /** |
---|
10 | * @class Ext.ux.form.SpinnerField |
---|
11 | * @extends Ext.form.NumberField |
---|
12 | * Creates a field utilizing Ext.ux.Spinner |
---|
13 | * @xtype spinnerfield |
---|
14 | */ |
---|
15 | Ext.ux.form.SpinnerField = Ext.extend(Ext.form.NumberField, { |
---|
16 | deferHeight: true, |
---|
17 | autoSize: Ext.emptyFn, |
---|
18 | onBlur: Ext.emptyFn, |
---|
19 | adjustSize: Ext.BoxComponent.prototype.adjustSize, |
---|
20 | |
---|
21 | constructor: function(config) { |
---|
22 | var spinnerConfig = Ext.copyTo({}, config, 'incrementValue,alternateIncrementValue,accelerate,defaultValue,triggerClass,splitterClass'); |
---|
23 | |
---|
24 | var spl = this.spinner = new Ext.ux.Spinner(spinnerConfig); |
---|
25 | |
---|
26 | var plugins = config.plugins |
---|
27 | ? (Ext.isArray(config.plugins) |
---|
28 | ? config.plugins.push(spl) |
---|
29 | : [config.plugins, spl]) |
---|
30 | : spl; |
---|
31 | |
---|
32 | Ext.ux.form.SpinnerField.superclass.constructor.call(this, Ext.apply(config, {plugins: plugins})); |
---|
33 | }, |
---|
34 | |
---|
35 | onShow: function(){ |
---|
36 | if (this.wrap) { |
---|
37 | this.wrap.dom.style.display = ''; |
---|
38 | this.wrap.dom.style.visibility = 'visible'; |
---|
39 | } |
---|
40 | }, |
---|
41 | |
---|
42 | onHide: function(){ |
---|
43 | this.wrap.dom.style.display = 'none'; |
---|
44 | }, |
---|
45 | |
---|
46 | // private |
---|
47 | getResizeEl: function(){ |
---|
48 | return this.wrap; |
---|
49 | }, |
---|
50 | |
---|
51 | // private |
---|
52 | getPositionEl: function(){ |
---|
53 | return this.wrap; |
---|
54 | }, |
---|
55 | |
---|
56 | // private |
---|
57 | alignErrorIcon: function(){ |
---|
58 | if (this.wrap) { |
---|
59 | this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]); |
---|
60 | } |
---|
61 | }, |
---|
62 | |
---|
63 | validateBlur: function(){ |
---|
64 | return true; |
---|
65 | } |
---|
66 | }); |
---|
67 | |
---|
68 | Ext.reg('spinnerfield', Ext.ux.form.SpinnerField); |
---|
69 | |
---|
70 | //backwards compat |
---|
71 | Ext.form.SpinnerField = Ext.ux.form.SpinnerField; |
---|