Skip to content
This repository

With allow_single_deselect, deselect state is wrong after liszt:updated #603

Closed
mmeisel opened this Issue · 10 comments

2 participants

Michael Meisel Patrick Filler
Michael Meisel
mmeisel commented

This one is a bit hard to explain, here's a jsfiddle:
http://jsfiddle.net/t2Gbb/

As you can see, after clicking the button (replacing the options dynamically), the correct text is shown, but the "X" remains, and the default text is not styled properly.

Michael Meisel
mmeisel commented

Actually, I over-complicated this example. All you have to do to run into this bug is set the select's value to "" programatically, then trigger a liszt:updated event. Here's a simplified fiddle:
http://jsfiddle.net/t2Gbb/1/

Patrick Filler pfiller closed this in 9c5ecab
Patrick Filler
Owner
pfiller commented

This should be fixed in master. Let me know how it goes for you.

Michael Meisel
mmeisel commented

Hi Patrick, thanks for the quick fix! Your change fixed the visual issue, but unfortunately it's causing a different problem... Since results_reset triggers a "change" event on the select, now triggering "liszt:updated" causes a "change" event to be triggered as well. This is different from the behavior of an un-"chosen" select, so it's wreaking all sorts of havoc on my other code, which isn't expecting another call to the "change" handler.

Patrick Filler pfiller reopened this
Patrick Filler
Owner
pfiller commented

Dang. Back to the drawing board.

Patrick Filler pfiller closed this in b028f9e
Patrick Filler
Owner
pfiller commented

@mmeisel Think b028f9e got it. Let me know if you're still seeing that!

Michael Meisel
mmeisel commented

Thanks Patrick, now the X is going away, but there is still one minor issue left -- the "chzn-default" class is missing afterwards, so the text doesn't appear grayed out like it does when you actually click the X.

Patrick Filler
Owner
pfiller commented

Getting closer. Try again? 0bdb09c

Michael Meisel
mmeisel commented

Looks good now, thanks!

Patrick Filler
Owner
pfiller commented

Borat is still current now, right?

Great Success

Michael Meisel
mmeisel commented
Patrick Filler pfiller referenced this issue from a commit
Patrick Filler Loooong overdue update to version 0.9.9
- ability to limit options {limit: n}
- add a way to retrieve chosen instance
- minified js now ends with ;
- two new events: (liszt:hiding_dropdown, liszt:showing_dropdown)
- support for selected disabled options #638
- Bug fix for disalbing options #603
- More flexible setting of default text #606
- When Chosen is disabled, don't allow deselect. #539
- Add a single_backstroke_delete option for deleting options #621
- Fixes tab order issues with single Chosen.
- Events for programatically opening Chosen. #771
- Add a disable_search option. #788
606af03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.