Autosize dropdownlist

2 posts, 0 answers
  1. Steven
    Steven avatar
    84 posts
    Member since:
    Oct 2010

    Posted 05 Jul 2012 Link to this post

    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:

    if( isDefined( this.options.width )) {
        if( this.options.width === "auto" ) {
         var popup = this.control.popup.element;
         var width = popup.css("visibility","hidden").show().outerWidth();
        } else {
         width = this.options.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)

  2. Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 10 Jul 2012 Link to this post

    Hi Steven,

    I would suggest you to use the Open event of the DropDownList - 

    I hope this helps.

    Petur Subev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top