Extension:ComboBoxAutoSize (Legacy)

This version of our Learning Center is unmaintained.
This article may be out-of-date or contain incorrect information.
Please visit the new Sencha Learning Center for up-to-date material.

Go to the new Sencha Learning Center

From Sencha - Learn

Jump to: navigation, search
Summary: Ext.form.ComboBox with autoSize, like in Ext.form.TextField
Author: Jon Ege Ronnenberg
Published: Februar 28, 2008
Version: 1.0
Ext Version: 1.1.*
License: N/A
Demo Link: No Demo
Forum Post: View Post

Contents

Description

The Ext.ux.ComboBox will have the same width as the widest item in the ComboBoxs data store.

The Ext.ux.ComboBox reimplements the autoSize functionality from Ext.form.TextField which it, in turns, inherit from. The Ext.ux.ComboBox extends only the Ext.form.ComboBox and only reintroduce the autoSize method.

Use

You have two options when you want to use the autoSize method. You can either specify grow: true in the config object or call the method autoSize when the ComboBox is rendered.

Config Option

// You can use the same settings in Ext.ux.ComboBox as in the normal ComboBox
var combo= new Ext.ux.ComboBox({
	store: Ext.data.Store,
	displayField: 'Ext.ux.ComboBox',
	mode: 'local',
	triggerAction: 'all',
	editable: false,
	forceSelection: true,
	shadow: true,
	name: 'myComboBox',
	grow: true    // this will "autoSize" the ComboBox when rendered
});

Call the method

// After the control is rendered
combo.autoSize();

Download

Ext.ux.ComboBox

This page was last modified on 28 February 2008, at 19:33. This page has been accessed 12,584 times.