Results 1 to 5 of 5

Thread: how can we set the auto width for the Drop down list of combobox

  1. #1

    Default how can we set the auto width for the Drop down list of combobox

    Hi,
    can anyone knows how to set the Auto width for the dropdown list of combobox , for example if in a combobox list length of one text is more than the width of list, then I need to increase the width of list to show the complete text.

    var searchFieldCombo = new Ext.form.ComboBox( {
    id : 'address',
    name : 'address',
    maxLength:'75',
    store : searchFieldStore,
    mode : 'remote',
    displayField : 'name',
    valueField : 'id',
    iconClsField: 'icon_airplane',
    cls:'destHlpTxt',
    listClass:'suggestiveTxt',
    plugins:new Ext.ux.plugins.IconCombo(),
    minChars:'3',
    height : 26,
    width:365,
    hideTrigger : true,
    tabIndex:'2',
    emptyText : 'Enter City, Address, Airport, Point of Interest',
    forceSelection : false,
    selectOnFocus : true,
    triggerAction : 'all'

    });

    Thanks in advance

  2. #2
    Sencha Premium User
    Join Date
    Jun 2008
    Location
    Belgium
    Posts
    265

    Default

    property listWidth



    Quote Originally Posted by vivekajm View Post
    Hi,
    can anyone knows how to set the Auto width for the dropdown list of combobox , for example if in a combobox list length of one text is more than the width of list, then I need to increase the width of list to show the complete text.

    var searchFieldCombo = new Ext.form.ComboBox( {
    id : 'address',
    name : 'address',
    maxLength:'75',
    store : searchFieldStore,
    mode : 'remote',
    displayField : 'name',
    valueField : 'id',
    iconClsField: 'icon_airplane',
    cls:'destHlpTxt',
    listClass:'suggestiveTxt',
    plugins:new Ext.ux.plugins.IconCombo(),
    minChars:'3',
    height : 26,
    width:365,
    hideTrigger : true,
    tabIndex:'2',
    emptyText : 'Enter City, Address, Airport, Point of Interest',
    forceSelection : false,
    selectOnFocus : true,
    triggerAction : 'all'

    });

    Thanks in advance

  3. #3

    Default length of dropdown list

    Hi ,
    Thanks for Reply,but listWidth set the default width of combobox , i want to set the AutoWIdth of dropdown list ,The default width for dropdown list must be equal to the width of combobox ,but when any text whose width is more than width of combobox then the width of list must be increase accordingly.

  4. #4
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,751

    Default

    hi vivekajm,

    Code:
    listWidth : Number
    The width (used as a parameter to Ext.Element.setWidth) of the dropdown list (defaults to the width of the ComboBox field). See also minListWidth
    maquejp was right with his config. if not set, the dropdown-list has the width of the combo. if set, you can make it wider.

    resizing the width of the dropdown (to be more precise of the Ext.DataView) is possible. you can resize it manually with:
    Code:
    myCombo.view.setWidth()
    to let it resize according to the content, a DataView has a config
    Code:
    autoWidth
    which could work. but you can't specify it with the combo-configs (+1 for feature-request adding viewConfig to comboBox). so, you would have to overwrite the initList-method of the combo, this part:

    Code:
                this.view = new Ext.DataView({
                    applyTo: this.innerList,
                    tpl: this.tpl,
                    singleSelect: true,
                    selectedClass: this.selectedClass,
                    itemSelector: this.itemSelector || '.' + cls + '-item',
                    emptyText: this.listEmptyText,
                    deferEmptyText: false
                   ,autoWidth: true
                });

    kind regards,
    tobiu
    Best regards
    Tobias Uhlig

  5. #5

    Default

    doesn't seem to work for IE

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •