Giter Club home page Giter Club logo

Comments (7)

sujameslin avatar sujameslin commented on May 29, 2024 2

@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.

yazonnile avatar yazonnile commented on May 29, 2024

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.

divined avatar divined commented on May 29, 2024

We have problem in react with clicking on the span - wrapper
It is not fired react onChange event =(

from jcf.

yazonnile avatar yazonnile commented on May 29, 2024

Show a component code please

from jcf.

kissds avatar kissds commented on May 29, 2024

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.

kissds avatar kissds commented on May 29, 2024

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.

yazonnile avatar yazonnile commented on May 29, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.