Skip to main content

Search and Top Navigation

#8934 open bug ()

Opened December 26, 2012 08:50AM UTC

Last modified August 20, 2014 01:15PM UTC

Spinner: Percentage functionality fails

Reported by: kvdeede Owned by:
Priority: minor Milestone: none
Component: ui.spinner Version: 1.9.2
Keywords: globalize Cc:
Blocked by: Blocking:
Description

The spinner percentage functionality fails.

From 0% it goes to 1% to 100% and afterwards it is impossible to go back to 0. When no maximum is set, it goes from 100% to 10.000% and it stays impossible to go back to a lower number.

I made a jsFiddle project here:

http://jsfiddle.net/7J8vs/

I checked and have exactly the same problem on jsFiddle as I have on my local project.

Attachments (0)
Change History (6)

Changed December 26, 2012 01:40PM UTC by tj.vantoll comment:1

status: newopen
summary: Percentage functionality spinner failsSpinner: Percentage functionality fails

Verified - http://jsfiddle.net/tj_vantoll/FrcFS/. I tried one with the US culture to make sure this wasn't just an issue with the culture file as well.

Changed December 26, 2012 02:42PM UTC by tj.vantoll comment:2

This seems to be due the step value being coerced into a number before it is passed into Globalize.

For example if you want to use a

step
of
'1%'
:

Globalize.format('1%', 'p', 'en-US')
returns '1%'. However, by the time
Globalize.format
is invoked the
step
option is now a number, and
Globalize.format(1, 'p', 'en-US')
returns
'100.00 %'
.

Changed December 26, 2012 02:47PM UTC by kvdeede comment:3

Note that a similar thing happens when you use a step of 0.01. It goes from 0% to 1% to 101% to 10,000%.

Changed December 27, 2012 02:25AM UTC by tj.vantoll comment:4

Globalize.parseFloat
is used to store the value of the step option when the spinner is created.
Globalize.parseFloat('1%', 10, 'en-US')
=> 1

Then when a step is done

Globalize.format
is used to determine what to display.

Globalize.format(1, 'p', 'en-US')
=> '100.00 %'

Changed January 25, 2013 09:23PM UTC by tj.vantoll comment:5

milestone: 1.10.0none

Changed August 20, 2014 01:15PM UTC by scottgonzalez comment:6

keywords: → globalize