-
Notifications
You must be signed in to change notification settings - Fork 115
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
onChange blocked #46
Comments
Here's a better solution that doesn't call onChange twice:
|
Why not use a $watch() statement in your angular controller? |
I could have, but I assumed all of the config options to work and would have saved a couple of hours of headscratching had I known the of the issue :) I was going to add that adding a $watch to the $digest cycle for each selectize input isn't ideal either, but then I'm unsure how that compares performance-wise with this implementation. |
+1 on this, same issue, onChange called twice |
+1 also seeing onChance called twice sounds like we should just watch the model for now |
+1 onChange does nothing, should expose same events as selectize |
Nor does onInitialize |
For what it's worth, the ng-change directive seems to work.
|
+1 onChange is being called twice |
2 similar comments
+1 onChange is being called twice |
+1 onChange is being called twice |
👏 |
As I wrote as comment to your commit (but I feel it belongs more here), I think you still need to set the silent flag to the setValue calls. Not only it prevents unnecessary calls (minor), but it also fixes the double call to onChange in the case of single selection mode. |
- setValue is always silent (see machineboy2045#46) - deactivate watch when updating the options list internally - user entered options, when removed, must be removed from the list - tested in https://plnkr.co/edit/2352rt
I've created a v3 branch that uses the latest version of Selectize: I was able to simplify the Angular directive a lot. I'd be curious what you I like the idea of adding support for objects. But I'm worried if we add What if I made an experimental branch? Maybe there could be a better name Also, thanks for all your contributions. I know you've been very active On Thu, Aug 6, 2015 at 1:30 AM, Philippe Lhoste [email protected]
|
Yes, it is nice, it has a cleaner style. Support for objects: would be nice, I can live without, it just has the overhead of searching the object in the list of options. A more risky operation (toward future versions of Selectize) would be to monkey-patch it to fix some issues, like I did in selectize/selectize.js#783 |
Setting an onChange config option has no effect.
Could be fixed by adding a line to selectize.js config.onChange:
For some reason my onChange function now gets called twice. Better than not at all though....
The text was updated successfully, but these errors were encountered: