I am trying to get the dropdownlist to auto size to the contents after an ajax load. In the dataBound event I have the following code:
It seems to operate to some degree, but the problem is the outerWidth is not calculated properly and I am still getting wrapping on the items in the dropdown list.
Is this an issue with the calculation or am I doing this too soon (i.e. while it is still loading)?
Is there a better way?
Is there a different event I should use? (using this method in the change event does not work at all)
if
( isDefined(
this
.options.width )) {
if
(
this
.options.width ===
"auto"
) {
var popup =
this
.control.popup.element;
var width = popup.css(
"visibility"
,
"hidden"
).show().outerWidth();
popup.hide().css(
"visibility"
,
"visible"
);
}
else
{
width =
this
.options.width;
}
this
.control.wrapper.closest(
".k-widget"
).width(width);
}
It seems to operate to some degree, but the problem is the outerWidth is not calculated properly and I am still getting wrapping on the items in the dropdown list.
Is this an issue with the calculation or am I doing this too soon (i.e. while it is still loading)?
Is there a better way?
Is there a different event I should use? (using this method in the change event does not work at all)