-
-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Values divergence when using with React.js #14
Comments
Hi @ikr, you need to use better-dom wrapper object interfaces to set the value. On your page try the code below: DOM.find("input").set("2010-09-20"); I suggest to find elements by var startInput = DOM.find("[name=start]"),
endInput = DOM.find("[name=end]");
...
startInput.set("2014-09-20");
endInput.set("2014-09-28"); |
Thanks! |
Not sure you you mean. The polyfill triggers As per value of the Let me know if you have a questing still. I guess I didn't fully understand your use case. |
Try changing a date value at http://ikr.su/h/react-period-of-stay-input/demo.html , and then inspect the corresponding input element with Firebug. The value in the DOM has not changed. Somehow, the polyfill magic seem to be at odds with the React magic :) |
Can I DOM.find('.period-of-stay-check-in input').change(function () {
// feed the new value to React
}); ? |
Sure, you can either: startInput.on("change", function() {
var currentValue = startInput.get();
// do something with it
}); or native: element.addEventListener("change", function(e) {
var currentValue = e.target.value;
// do something with it
}, false); In other words better-dom exposes native events that you can use to be notified. |
Thank you so much! You're very helpful! I believe I get it now: Thus, to make it work with React views (something oblivious to |
@ikr yes, you are right, the polyfill does not synchronise the It's cool to make a perfect polyfill you described. But for instance in that case we have to use Shadow Dom, because currently the polyfill adds date picker |
@chemerisuk Got it. Thx! |
@ikr how your code looks like? I want to investigate the usefulness of feature, that allows to watch for the |
@ikr sorry for being annoying but I really need your feedback on that. |
@chemerisuk Sorry, had a vacation :) I've published the solution to my problem as a StackOverflow answer. All the code is on GitHub. You may be particularly interested in commit 8f199449841635526428cba58498a0f989584f43, before the switch to jQuery UI. |
Thanks for the response @ikr. The feature mentioned in the ticket in my schedule for the next version. |
I'm having trouble making the better-dateinput-polyfill work with Facebook's React library. The control doesn't update the input's value for some reason. Also, the programmatic changes to the DOM element's "value" attribute aren't reflected in the date picker widget.
You can see yourself here
Any ideas how to deal with it?
The non-minified source code is here.
The text was updated successfully, but these errors were encountered: