diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-01-07 09:12:27 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-01-07 09:12:27 -0500 |
commit | 31ebe7e7da7d7ce737a1feb3b19dec047e88a3a5 (patch) | |
tree | 960d34f7841169d909d72ea77e13b26a521614c2 /ui | |
parent | f63820769d99ccbf6d0178322ffe75b7b321277b (diff) | |
download | jquery-ui-31ebe7e7da7d7ce737a1feb3b19dec047e88a3a5.tar.gz jquery-ui-31ebe7e7da7d7ce737a1feb3b19dec047e88a3a5.zip |
Spinner: Allow strings for min, max, and step options, converting immediately to numbers based on numberFormat and culture.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.spinner.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index b78b4dbea..c99520b7c 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -45,7 +45,14 @@ $.widget( "ui.spinner", { }, _create: function() { + // handle string values that need to be parsed + this._setOption( "max", this.options.max ); + this._setOption( "min", this.options.min ); + this._setOption( "step", this.options.step ); + + // format the value, but don't constrain this._value( this.element.val(), true ); + this._draw(); this._bind( this._events ); this._refresh(); @@ -318,6 +325,12 @@ $.widget( "ui.spinner", { return; } + if ( key === "max" || key === "min" || key === "step" ) { + if ( typeof value === "string" ) { + value = this._parse( value ); + } + } + this._super( key, value ); if ( key === "disabled" ) { |