Spinner: decimals and stepping now independent (user request)

This commit is contained in:
Ca-Phun Ung 2008-09-20 14:46:26 +00:00
parent 068d2483c9
commit 27ba2ff84f

View File

@ -17,13 +17,13 @@ $.widget('ui.spinner', {
// terminate initialization if spinner already applied to current element // terminate initialization if spinner already applied to current element
if($.data(this.element[0], 'spinner')) return; if($.data(this.element[0], 'spinner')) return;
// check for onInit callback // check for Init callback
if (this.options.init) { if (this.options.init) {
this.options.init(this.ui(null)); this.options.init(this.ui(null));
} }
// check for decimals in steppinng and set _decimals as internal (needs cleaning up) // check for decimals in steppinng and set _decimals as internal
this._decimals = 0; this._decimals = parseInt(this.options.decimals);
if (this.options.stepping.toString().indexOf('.') != -1) { if (this.options.stepping.toString().indexOf('.') != -1) {
var s = this.options.stepping.toString(); var s = this.options.stepping.toString();
this._decimals = s.slice(s.indexOf('.')+1, s.length).length; this._decimals = s.slice(s.indexOf('.')+1, s.length).length;
@ -303,6 +303,7 @@ $.widget('ui.spinner', {
$.extend($.ui.spinner, { $.extend($.ui.spinner, {
defaults: { defaults: {
decimals: 0,
stepping: 1, stepping: 1,
start: 0, start: 0,
incremental: true, incremental: true,