Slider: Slider.js:423 Uncaught TypeError: Cannot read property 'toFixed' of undefined(…)

Created on 24 Oct 2016  Â·  5Comments  Â·  Source: react-component/slider

Hello!
I'm trying to set up logarithmic scale slider (as described in https://github.com/react-component/slider/issues/150) with value and marks:

<Slider defaultValue={ 100 } marks={{10:'10', 100:'100', 1000:'1000', 10000:'10k', 100000:'100k'}} value={[10, 100, 1000, 10000, 100000]} onChange={this.onSpendingChange} />

How I could use value parameter without getting error with toFixed?

All 5 comments

Make sure which one are you going to use, Slider or Slider[range]?

@benjycui simple one, without ranges
Actually I need a slider with marks like this one, but with a single value:

cannot figure out if it's possible without modifying the code

https://github.com/react-component/slider#props

value is a number while Slider[range=false], please read the documentation.

@benjycui actually documentation mentions only defaultValue, not value.

value number or [number, number, ...] Set current positions of handles. If range is false, the type of defaultValue should be number. Otherwise, [number, number, ...]

@ql It seems that the example described in #150 is no longer supported (I'm not sure if it ever was), or at least is unclear from the docs in how to implement it. You could translate the value of the slider to your own scale with a function, depending on your use case.

Logarithmic scales do not seem to be supported, an issue that I'm not sure the maintainer understands. However, they are in bootstrap-slider.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Gautierrr picture Gautierrr  Â·  7Comments

sonovice picture sonovice  Â·  7Comments

dvshur picture dvshur  Â·  3Comments

johnb8005 picture johnb8005  Â·  6Comments

koenvo picture koenvo  Â·  5Comments