Ext JS - Learning Center

Extension:ComboBoxAutoSize

From Learn About the Ext JavaScript Library

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 19:33, 28 February 2008.
  • This page has been accessed 1,562 times.