75 lines
2 KiB
JavaScript
75 lines
2 KiB
JavaScript
/*
|
|
This file is part of Ext JS 3.4
|
|
|
|
Copyright (c) 2011-2013 Sencha Inc
|
|
|
|
Contact: http://www.sencha.com/contact
|
|
|
|
GNU General Public License Usage
|
|
This file may be used under the terms of the GNU General Public License version 3.0 as
|
|
published by the Free Software Foundation and appearing in the file LICENSE included in the
|
|
packaging of this file.
|
|
|
|
Please review the following information to ensure the GNU General Public License version 3.0
|
|
requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
|
|
|
If you are unsure which license is appropriate for your use, please contact the sales department
|
|
at http://www.sencha.com/contact.
|
|
|
|
Build date: 2013-04-03 15:07:25
|
|
*/
|
|
Ext.ns('Ext.ux.form');
|
|
|
|
/**
|
|
* @class Ext.ux.form.SpinnerField
|
|
* @extends Ext.form.NumberField
|
|
* Creates a field utilizing Ext.ux.Spinner
|
|
* @xtype spinnerfield
|
|
*/
|
|
Ext.ux.form.SpinnerField = Ext.extend(Ext.form.NumberField, {
|
|
actionMode: 'wrap',
|
|
deferHeight: true,
|
|
autoSize: Ext.emptyFn,
|
|
onBlur: Ext.emptyFn,
|
|
adjustSize: Ext.BoxComponent.prototype.adjustSize,
|
|
|
|
constructor: function(config) {
|
|
var spinnerConfig = Ext.copyTo({}, config, 'incrementValue,alternateIncrementValue,accelerate,defaultValue,triggerClass,splitterClass');
|
|
|
|
var spl = this.spinner = new Ext.ux.Spinner(spinnerConfig);
|
|
|
|
var plugins = config.plugins
|
|
? (Ext.isArray(config.plugins)
|
|
? config.plugins.push(spl)
|
|
: [config.plugins, spl])
|
|
: spl;
|
|
|
|
Ext.ux.form.SpinnerField.superclass.constructor.call(this, Ext.apply(config, {plugins: plugins}));
|
|
},
|
|
|
|
// private
|
|
getResizeEl: function(){
|
|
return this.wrap;
|
|
},
|
|
|
|
// private
|
|
getPositionEl: function(){
|
|
return this.wrap;
|
|
},
|
|
|
|
// private
|
|
alignErrorIcon: function(){
|
|
if (this.wrap) {
|
|
this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]);
|
|
}
|
|
},
|
|
|
|
validateBlur: function(){
|
|
return true;
|
|
}
|
|
});
|
|
|
|
Ext.reg('spinnerfield', Ext.ux.form.SpinnerField);
|
|
|
|
//backwards compat
|
|
Ext.form.SpinnerField = Ext.ux.form.SpinnerField;
|