harvesthq/chosen — Issue #472: Fix for zero-width problem
Author: gullbyrd
Created: 2012-01-30 15:17:11+00:00
State: open

I like Chosen, but because I use a lot of ajax and hidden panels, I've been having hellish problems with Chosen rendering the selects with zero width, apparently because the width is being calculated before the select is visible.

I added a line that seems to fix this problem (or provide a workaround), at least in my case.

In the Chosen.prototype.set_up_html function, after "this.f_width = this.form_field_jq.outerWidth();", add:

if (this.f_width==0) this.f_width = this.form_field_jq.css("width");

Obviously, this only works if the width is explicitly set in css. But in my case, it solves the problem. A better fix would be welcome.