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

Closed
mmeisel opened this Issue May 2, 2012 · 10 comments

Comments

Projects
None yet
2 participants

mmeisel commented May 2, 2012

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.

mmeisel commented May 2, 2012

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/

@pfiller pfiller closed this in 9c5ecab May 3, 2012

Contributor

pfiller commented May 3, 2012

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

mmeisel commented May 3, 2012

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.

@pfiller pfiller reopened this May 3, 2012

Contributor

pfiller commented May 3, 2012

Dang. Back to the drawing board.

@pfiller pfiller closed this in b028f9e May 8, 2012

Contributor

pfiller commented May 8, 2012

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

mmeisel commented May 8, 2012

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.

Contributor

pfiller commented May 8, 2012

Getting closer. Try again? 0bdb09c

mmeisel commented May 8, 2012

Looks good now, thanks!

Contributor

pfiller commented May 8, 2012

Borat is still current now, right?

Great Success

mmeisel commented May 9, 2012

Very nice!

On Tue May 8 10:42:30 2012, Patrick Filler wrote:

Borat is still current now, right?

Great Success


Reply to this email directly or view it on GitHub:
#603 (comment)

pfiller added a commit that referenced this issue Nov 28, 2012

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment