PDA

View Full Version : SpinnerFiled has strange behaviour when click up arrow



emaze
4 Jul 2017, 6:45 AM
When run the SpinnerField example from documentation page and click with mouse the up arrow multiple times the number doesn't increment but character "1" being simply added to the string. Example: if you click three times cannot obtain 3 but 111.
If you use keyboard keys works well.

Mark.Brocato
5 Jul 2017, 6:43 AM
Strange... I cannot reproduce that. What browser/version/OS are you using?

emaze
5 Jul 2017, 10:49 PM
Hi Mark,
I'm using Ubuntu 14.04 and Firefox 54 or Chrome 53.
You can reproduce that behaviour in http://docs.sencha.com/extreact/6.5.0/modern/Ext.field.Spinner.html
(http://docs.sencha.com/extreact/6.5.0/modern/Ext.field.Spinner.html)If I use that component in my application it works as in documentation example.
Otherwise in the Kitchen Sink works well.

Mark.Brocato
6 Jul 2017, 5:30 AM
I see, there is a bug in the example. The minValue, maxValue, and stepValue props should have numeric values, not strings. I will open up a ticket to fix the example.

Here is the correct code:



import React, { Component } from 'react';
import { Container, SpinnerField, FormPanel } from '@extjs/ext-react';


export default class MyExample extends Component {
render() {
return (
<Container layout="center">
<FormPanel shadow>
<SpinnerField
label="Spinner"
width="150"
minValue={0}
maxValue={10}
stepValue={1}
/>
</FormPanel>
</Container>
)
}
}

LesJ
7 Jul 2017, 2:12 PM
Why the component is not coercing string configs to number in this case?

I created a feature request (https://www.sencha.com/forum/showthread.php?353810-Component-numeric-configs-should-be-coerced-to-number-if-specified-as-a-string).