-
Notifications
You must be signed in to change notification settings - Fork 53
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
fix select "bind to multiple" implementation and sample #86
Comments
Please comment on this change: aurelia-materialize-bridge/src/select/select.js Lines 36 to 41 in 43ccb0c
I'm totally unsure if that's a good practice or more of an abuse of observerLocator. |
After a chat session with @charlespockert I've reverted this to using a CustomEvent. Charles' version works in a plunk with a multiple select and without Materialize. I've forked that plunk and changed it to use a multiple select here: http://plnkr.co/edit/2zwr4ExgNndjFVeiqUVW?p=preview In Materialize bridge, though, it doesn't work. If you select some options in a multiple select, the bound view model variable is not updated. The Materialize version triggers that flush before the event is triggered. Still, the underlying array is mutated, has changed and this is detected correctly. Here is what happens: In Charles' plunk, the above is exactly what happens. In Materialize bridge, I don't know yet, what all this means but before I forget, I put it here. |
My attitude, exactly - with this additional explanation. I care a lot about understanding everything that happens in our team and it surrounding - so I subscribe to all these events as a service of Github. However, there is almost never a chance to spot one event and process it immediately and fully. So, saving the content of any discussion for your and other's later reading is really a must. Thank you Daniel !! |
Haha, I just noticed the color switcher selects are also broken now. 😄 @adriatic I will do this more often now since I know I forget things and the above is complicated enough to let me forget it over the weekend. 😄 |
for reference: Dogfalo/materialize#2670 (comment) |
I still don't get it really. The select The this.valueObserver.value = $(this.element).val();
this.valueObserver.notify(); In knockout/Durandal I'd do Somehow I can't wrap my mind around that issue. |
Note to myself: read this https://github.com/jdanyow/aurelia-breeze-northwind/blob/master/src/resources/materialize.js |
Let me know how easy was it to read this code :-) |
Very easy. Everything is commented. 😄 Although I usually need to apply those things to some practice before I really understand it. In short, it's easy to understand what it does but I don't know yet why he does it. One thing is apparent, though: He also circumvents problems with getting the selected value. Even by implementing dirty checking and using an own MutationObserver. I will have to try it. 😄 |
Could it be that easy...? |
No, it's not that easy... Almost reproduced.. Seems like I wouldn't have that problem if Materialize fired a custom event on change. |
Wow.. Turns out this is actually a problem (or intended behaviour) of combining string interpolation with valueConverters and array mutations. Data is set correctly but the output isn't updated.. Changing the output to a |
It's okay when selecting things but changing the view-model directly (which means: assign an object) breaks the sample.
The text was updated successfully, but these errors were encountered: