Width of selectMenu in jqueryui.
Hi,
I use several selectMenu to filter a table. I've item option with image and/or text
I use this code for this :
- $("select.TFOlstJquery").TFOiconSelectImg({
- create: function (event, ui) {
- var widget = $(this).TFOiconSelectImg("widget"); var $SpanTxt = widget.children(":last"); var elem = $(this).children(":first"); var styl = elem.data("style"); var HasTxt = ($.trim(elem.text()).length > 0);
- if (HasTxt && styl) { $SpanTxt.addClass("TFOselectmenu-textDecalTxt") } else { $SpanTxt.removeClass("TFOselectmenu-textDecalTxt") }
- if (styl) { $span = $('<span class="' + (HasTxt ? "TFOSizeImgTxtSelected" : "TFOSizeImgOnlySelected") + ' TFOOptlstFiltreImg"> ').appendTo($SpanTxt); $span.attr("style", styl); }
- if ($(this).hasClass("lstHeader")) { widget.css({ 'width': '' }); widget.addClass("lstHeader") }
- },
- select: function (event, ui) {
- var widget = $(this).TFOiconSelectImg("widget"); var $SpanTxt = widget.children(":last"); var elem = ui.item.element; var styl = elem.data("style"); var HasTxt = ($.trim(elem.text()).length > 0);
- if ((HasTxt && styl) || elem.hasClass("FiltreFaux") || elem.hasClass("FiltreVrai")) { $SpanTxt.addClass("TFOselectmenu-textDecalTxt") } else { $SpanTxt.removeClass("TFOselectmenu-textDecalTxt") }
- if (styl || elem.hasClass("FiltreFaux") || elem.hasClass("FiltreVrai")) {
- var $span = $('<span class="' + (HasTxt ? "TFOSizeImgTxtSelected" : "TFOSizeImgOnlySelected") + ' TFOOptlstFiltreImg">').appendTo($SpanTxt);
- if (styl) { $span.attr("style", styl); } else if (elem.hasClass("FiltreFaux")) { $span.addClass("FiltreFaux") } else if (elem.hasClass("FiltreVrai")) { $span.addClass("FiltreVrai") }
- }
- },
- change: function (event, ui) { if ($(this).hasClass("TFOlstFiltreImg")) { GetRowsTFO(nameW); } }
- }).TFOiconSelectImg("menuWidget");
-
It's run. But when I want to minimize the width of my selectMenu, I see in debugger an ul element is generated. and a width is fixed. In result when I click on my list, the options are widther than my selected item list.
If debugging is the art of removing bugs ... then program is the art of creating