Comments (7)
@yazonnile Yes, i think i didn't make it clear.
With jQuery, its straightforward. We can just call jcf.replaceAll
in component's componentDidMount
.
But jquery usage is not recommended way in react community.
If you guys can make vanilla js version, it would be really great.
Actually its what i was looking for in this issue.
from jcf.
jcf still requires jquery, because we dont have enough time to make vanilla js version.
Its about jquery.
But working with react shouldnt really be a problem. In componentDidMount you could init jcf with any api call (jcf.replaceAll for example);
from jcf.
We have problem in react with clicking on the span - wrapper
It is not fired react onChange event =(
from jcf.
Show a component code please
from jcf.
Hi!
i have a same problem with onChange on input type="number"
i have tag
<input onChange={this.handlingQuantity.bind(this)} required ref="quantity" name="quantity" type="number" min="1" value={this.state.quantity} max={this.state.unitsAvailable} className="number form-control" id="q-desk"/>
and handler
handlingQuantity(event) {
this.setState({
quantity: event.target.value
});
}
But if i used jcf and click on jcf-btn-inc or jcf-btn-dec - onChange={this.handlingQuantity.bind(this)} don't work
All other plugins work fine: select, checkbox, radio, etc.
from jcf.
The matter was that onchange in javascript and onChange in React are different.
Clicking on .jcf-btn-inc works trigger in the plugin this.realElement.val(newValue).trigger('change');
, but onChange in React does not work
I solved this problem like this
componentDidMount() {
let self = this;
document.getElementById('q-desk').onchange = function(e) {
self.handlingQuantity(e, this.value);
}
}
handlingQuantity(event, eventValue) {
this.setState({
quantity: eventValue
});
}
from jcf.
Yes, because jquery and react have two different event models.
In your case you can do something like this
https://jsfiddle.net/m93gL86e/
All in all - you can create some Factory Component that will take only onChange function and will attach jquery onchange under the hood.
from jcf.
Related Issues (20)
- Wrong selectbox rendering after reset form with scrollable.js HOT 1
- full-text search for select box
- Keyboard Tab to switch to next form controll not working
- scrollable looses styling on ios
- Default number input with step 2 on touchpads
- Issue with custom scroll on iOS HOT 1
- programmatically close dropdown when going out of focus HOT 2
- Select options disappear after programmatically trigger hideDropDown HOT 2
- How to unbind element with JCF. HOT 1
- Can I turned off init jcf-scrollable on resize? HOT 1
- How can I do scrollTop? HOT 1
- How to hide the option from JCF dropdown when native select is hidden using method hide() HOT 1
- onchange of select HOT 1
- Have to use small hack with v-model checkboxes on vue.js 2.x HOT 1
- Selection popup dissapears after clicking on dropdown element in Firefox on mobile HOT 1
- How can I close select dropdown programmatically? HOT 2
- compatibility jquery 3
- How to exclude elements from rendering HOT 1
- Ajax loading HOT 3
- JCF js library does not allow smartphone wheels (IOS device ) on multiple selection select fields
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 jcf.