I’m attempting to use this plugin, which turns a select list into a combo box where the user can type their selection in, in addition to the select list functionality.
http://vladimir-k.blogspot.com/2009/02/sexy-combo-jquery-plugin.html
The issue I’m having, is when the select list is inside of a jquery dialog, it no longer has the drop down functionality. The autocomplete functionality still works if you hit tab or enter with the first few letters of a known value typed in, but the box full of options doesn’t appear. Has anybody else encountered this? Is there a known solution/workaround?
from site.master
<link href="<%= Url.Content("~/Content/sexy-combo.css") %>" rel="stylesheet" type="text/css" />
<link href="<%= Url.Content("~/Content/sexy/sexy.css") %>" rel="stylesheet" type="text/css" />
<link href="<%= Url.Content("~/Content/custom/custom.css") %>" rel="stylesheet" type="text/css" />
<script src="<%= Url.Content("~/Scripts/jquery.sexy-combo.min.js") %>" type="text/javascript"></script>
<script src="<%= Url.Content("~/Scripts/jquery.bgiframe.min.js") %>" type="text/javascript"></script>
from EditProduct.ascx(loaded inside of dialog)
<script type="text/javascript">
$('#subCategories').sexyCombo();
</script>
<%: Html.DropDownList("CategoryId", new SelectList(Model.ProductCategories, "CategoryId", "CategoryName", Model.Product.CategoryId), new{ id="subCategories"}) %>
I figured out the solution from some of the comments on the google code page. At about line 194 of the jquery.sexy-combo.js script theres a line like this:
The problem is, inside of a jquery dialog, for whatever reason, listItems.outerHeight(); returns 0 every time. So to fix this and get the correct behavior, someone recommended setting singleItemheight to some arbitrary value if it was set to 0, like so:
Thanks for your suggestions, I really didn’t want to have to rewrite my own plugin because I have too much on the go as is.