-
Notifications
You must be signed in to change notification settings - Fork 439
$dirty is true when no changes were made and 'options' came via json array (or similar) #151
Comments
I just ran into the exact same issue myself. The solution I found required a slight tweak to the code. No PR because it's a quick hack with no testing and I suck at git. Sorry. :-/ So, find your existing $watch method and move the "elm.trigger('change');" line to within an "else" statement. If this breaks other stuff, feel free to tell me I'm horribly wrong, I only just figured this out a few minutes ago.
|
👍 to anyone could/knew how to fix this. |
+1 |
+5000 (on the behalf of everyone using our app) |
Your hack is not working for me, @johnsouth. Could you apply your fix to the Plunker from @genuinefafa? |
Any chance to fix this soon? |
@ChristianGruen @NMichas Tell me if it helps :) |
Thanks @mavericker. Unfortunately, it doesn’t seem to help. In fact, <input type="hidden" ui-select2="settings.select2Options" ng-model="..."/> $settings.select2Options = {
multiple: true,
ajax: { ... }
}; |
Are you able to post code where you have problems? I have already solved all problems inside my project. So maybe i will help you. |
Unfortunately not, but we’ll try to create a reproducible example. Thanks in advance! |
Are you able to change https://github.com/angular-ui/ui-select2/blob/master/src/select2.js#L127 from elm.trigger('change'); to controller.$render(); and https://github.com/angular-ui/ui-select2/blob/master/src/select2.js#L209 from var isPristine = controller.$pristine;
controller.$setViewValue(
convertToAngularModel(elm.select2('data'))
);
if (isPristine) {
controller.$setPristine();
} to var isPristine = controller.$pristine;
controller.$pristine = false;
controller.$setViewValue(
convertToAngularModel(elm.select2('data'))
);
if (isPristine) {
controller.$setPristine();
} |
This could be the solution! I’ll do some more testing tomorrow and will let you know if everything works as expected… |
I have it integrated inside approx 700-1000 select boxes and everything seems to be fine. When you will test it inside your app i will post new PR . Thanks for reply |
You're solution works for me, @mavericker 👍 |
Thank you very much for response i will post PR today :) |
Confirmed; works fine ;) |
Sorry for pushing this… Did sth. go wrong in the pull request? |
Nope i just forget :) Will make it tonight. 2014-05-19 20:11 GMT+02:00 Christian Gruen [email protected]:
|
Finally found time , here you are |
I'm not sure if I shall test it again, or if you are going to release a new version now that this issue was solved. ps: I was silent, but not deft ;) |
That fix is working , but somehow travis is failing with some bower error. I am not able to automatic merge it to master .... |
@genuinefafa Take PR #215 it is tested by Christian and HoffZ and also by me. |
Any news? Has this already been merged? |
I cant merge it , but not because error but travis build is erroring due bower install. I am not able to merge it , even if all tests passed |
Thanks for the feedback. Any chance to help you? |
I cant find any contact to project maintaner to contact him about issues with build, if you can help me with that i would be happy 👯 |
@mavericker: I wrote to their mailing list. What do you think about the warning?.. https://groups.google.com/forum/#!topic/travis-ci/zGqeu3Uso9E |
Hello i dont think it is commit related, because when you make clean FORK of latest ui-select2 master, and edit for example 1 line inside README.md. you will gete this error. So i think its related to ui-select2 build config..... or maybe travis is bugged. Error is : npm ERR! Error: No compatible version found: minimatch@'^0.3.0' npm ERR! Valid install targets: npm ERR! ["0.0.1","0.0.2","0.0.4","0.0.5","0.1.1","0.1.2","0.1.3","0.1.4","0.1.5","0.2.0","0.2.2","0.2.3","0.2.4","0.2.5","0.2.6","0.2.7","0.2.8","0.2.9","0.2.10","0.2.11","0.2.12","0.2.13","0.2.14","0.3.0"] But dependency is not required by my code, but from select2 itself. If you understand what i mean .... |
I think I understand. Do you know who’s responsible for the ui-select2 master and the build configuration? |
I think https://github.com/ProLoser this guy , maybe contact him trough 2014-05-27 10:49 GMT+00:00 Christian Gruen [email protected]:
|
...waiting for some feedback. On Tue, May 27, 2014 at 12:53 PM, Mavericker [email protected]
|
I've confirmed that PR #215 fixes the issue for me. Any word from the maintainers? |
i think they left this repo and started maintaining new version of select2 https://github.com/angular-ui/ui-select its native version without jquery and original select2, i can confirm that it works very well .... try to replace your select2 with the new one. |
@MilosMosovsky do you think is the select2 native version is as stable as this one? I did a dry-run to a simple project and found it pretty slim. :( |
- updated to latest select2 and jquery - add minified version
I made a new release that includes the fix proposed here and it is available on bower by 'angular-nca-select2'. There is also a minified version in the release. We use this as a temporary solution in our project and it will be deleted when a new version of angular-ui-select2 is published. Thanks @MilosMosovsky :) |
Fix incorrect dirty flag when initializing from JSON #151
@PesanskiGoran does your version differs from the uploaded here, how? I mean, the PR was accepted and is now working, is it not? My project has some workaround for this issue. I need to do major changes now to test this. I would prefer having all the required information first |
@genuinefafa The pull request is now in the master, but there is no release available yet. The version from @PesanskiGoran is based on the latest master (including the fix described above) and contains also a minified version of angular-ui-select2. The repo is only a temporary workaround for us until the fix is available in a version via bower. |
Following #6 that is closed and mostly angular-ui/angular-ui-OLDREPO#268 (from the old repo).
I'm using the latest tagged version 0.0.5 and found that $dirty is always true when the form is loaded and the options came via a json array.
AFAIK It should be false if no changes were made.
Any clue on how to fix it? I made an example plunkr.
The text was updated successfully, but these errors were encountered: