Resize Ext.form.ComboBox to fit its content

Posted by ITRushn on Stack Overflow See other posts from Stack Overflow or by ITRushn
Published on 2010-04-27T18:07:12Z Indexed on 2010/04/27 20:53 UTC
Read the original article Hit count: 334

Filed under:
|
|
|
|

There are quite few solutions on Ext forums, but I wasn’t able to get any of them work. It seems I am missing something minor.

I need to resize combobox to fit its content when it’s first created. I do not need to worry about resizing it when content is changing.

Is there any working examples using Extjs 3.2?

Current Code:

var store = new Ext.data.ArrayStore({
    fields: ['view', 'value', 'defaultselect'],
    data: Ext.configdata.dataCP
});

comboCPU = new Ext.form.ComboBox({
    tpl: '<tpl for="."><div class="x-combo-list-item"><b>{view}</b><br /></div></tpl>',
    store: store,
    displayField: 'view',
    width: 600,
    typeAhead: true,
    forceSelection: true,
    mode: 'local',
    triggerAction: 'all',
    editable: false,
    emptyText: 'empty text',
    selectOnFocus: true,
    listeners: { select: AdjustPrice, change: AdjustPrice, beforeselect: function (combo, record, index) { return ('false' == record.data.disabled); } },
    applyTo: 'confelement'
});

I've also tried removing width: 600 and replacing it with minListWidth: 600 but that result following and didnt fix the issue. alt text

© Stack Overflow or respective owner

Related posts about extjs

Related posts about resize