Results 1 to 4 of 4

Thread: Resize combobox to fit its content

  1. #1

    Default Resize combobox to fit its content

    There are many thread to solve this issue, but I wasnt able to get any of them work. It seems I am missing something minor.
    I need to resize combobox to fit its content when its first created. I do not need to worry about resizing it when content is changing.
    Is there any working examples using Extjs 3.2?

    My Code:
    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'
    	});

  2. #2
    Sencha User
    Join Date
    Jun 2009
    Location
    Colorado
    Posts
    51

    Default

    I believe the only thing restricting your ComboBox from automatically sizing to it's contents is where you set width: 600. I believe this will force the ComboBox to a static width of 600 pixels. If you would like to have it automatically size, but give it a minimum width - try getting rid of the width: 600 line, and using minListWidth:

  3. #3

    Default

    Keylan
    Thanks for your response, however it didnt help. Now combobox became even shorter, and list is still doesnt display full values.


  4. #4

    Exclamation Please help

    Does anyone else know how I can make sure that combobox and list are able to fully display option?

Tags for this Thread

Posting Permissions

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