Comments (12)
I used ref
for this.
<Nouislider
range={{
min: 0,
max: 7
}}
onSlide={this.onChangeSlide.bind(this)}
ref="NoUiSlider"
/>
and within the ref object you can access slider.get()
onChangeSlide(){
console.log(this.refs.NoUiSlider.slider.get()) // logs the value
}
from react-nouislider.
If we ever expose this get method it would be in a React way but that I do not know how, any idea @bobylito?
Otherwise, what you can do right now is use events: https://github.com/algolia/react-nouislider/blob/master/index.js#L18
- props.onUpdate
- props.onSlide
- props.onChange
They all relate to http://refreshless.com/nouislider/events-callbacks/
from react-nouislider.
@vvo Thanks, but what point is there in an onSlide event if you can't return the value?
from react-nouislider.
From reading the nouislider configuration I think inside the event listener you can use this.get() to get the actual values.
And even the arguments should contain all the information you need: http://refreshless.com/nouislider/events-callbacks/#section-binding
let me know
from react-nouislider.
Yup, it works with the three events you've defined. Cheers.
EDIT: this.get is not a function
. Not yet sure if this is a scope problem or an issue with the actual component.
from react-nouislider.
Might be a binding issue, wanna help sovling it?
from react-nouislider.
Awesome, thanks for feedback!!!
from react-nouislider.
I am able to get the onSlide property to work. This is dispatching an action to a redux store in my case and I am able to successfully capture the range low and range high values. The only issue is that the handles will not move - as if the components onSlide property was providing for the handle animation and placement and by 'hijacking' this prop to be used by react that functionality is broken
from react-nouislider.
Maybe you need the default nouislider css? https://github.com/leongersen/noUiSlider/blob/master/distribute/nouislider.css
If so, can you add this to the documentation? Thanks.
from react-nouislider.
Thank you for the advise. I had the css in my code. After examining it looks like the problem is that the <Nouislider />
object is re-rendering every time the onSlide event fires.
from react-nouislider.
Yes, clearly I would advise now to use the airbnb slider which is full react and better suited, http://airbnb.io/projects/rheostat/
from react-nouislider.
Cool thanks again - I will check that out. Got it working by passing in start array params based on props gathered by onSlide 💯
from react-nouislider.
Related Issues (20)
- Import name HOT 2
- Disabled slider support HOT 1
- Error when implementing inside another component HOT 2
- "Behavior" attribute not passing into slider HOT 2
- Does not support server-side rendering HOT 3
- Formatting of tooltips HOT 8
- Using "Tooltips" is giving Warning in console HOT 1
- Flickering on re-render HOT 4
- Binding 'this' in onUpdate callback causes infinite render 'call stack exceeded' HOT 11
- Getting the end event HOT 4
- tooltip overlays handle after 2 handles HOT 1
- Passing connect array fail HOT 3
- Connect PropTypes have changed HOT 2
- nouislider needs to be updated HOT 9
- connect not showing? HOT 1
- Sliders getting stuck on the edge. HOT 1
- onStart fires multiple times when sliding, resulting touch stuck HOT 1
- Not working with React 16 due to use of propTypes from React, need to use 'prop-types' module to make it compatible HOT 5
- Remove decimals? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-nouislider.