Alien-Web-ExtJS-V3
view release on metacpan or search on metacpan
share/src/widgets/form/Combo.js view on Meta::CPAN
/*
This file is part of Ext JS 3.4
Copyright (c) 2011-2013 Sencha Inc
Contact: http://www.sencha.com/contact
GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version 3.0 as
published by the Free Software Foundation and appearing in the file LICENSE included in the
packaging of this file.
Please review the following information to ensure the GNU General Public License version 3.0
requirements will be met: http://www.gnu.org/copyleft/gpl.html.
If you are unsure which license is appropriate for your use, please contact the sales department
at http://www.sencha.com/contact.
Build date: 2013-04-03 15:07:25
*/
/**
* @class Ext.form.ComboBox
* @extends Ext.form.TriggerField
* <p>A combobox control with support for autocomplete, remote-loading, paging and many other features.</p>
* <p>A ComboBox works in a similar manner to a traditional HTML <select> field. The difference is
* that to submit the {@link #valueField}, you must specify a {@link #hiddenName} to create a hidden input
* field to hold the value of the valueField. The <i>{@link #displayField}</i> is shown in the text field
* which is named according to the {@link #name}.</p>
* <p><b><u>Events</u></b></p>
* <p>To do something when something in ComboBox is selected, configure the select event:<pre><code>
var cb = new Ext.form.ComboBox({
// all of your config options
listeners:{
scope: yourScope,
'select': yourFunction
}
});
// Alternatively, you can assign events after the object is created:
var cb = new Ext.form.ComboBox(yourOptions);
cb.on('select', yourFunction, yourScope);
* </code></pre></p>
*
* <p><b><u>ComboBox in Grid</u></b></p>
* <p>If using a ComboBox in an {@link Ext.grid.EditorGridPanel Editor Grid} a {@link Ext.grid.Column#renderer renderer}
* will be needed to show the displayField when the editor is not active. Set up the renderer manually, or implement
* a reusable render, for example:<pre><code>
// create reusable renderer
Ext.util.Format.comboRenderer = function(combo){
return function(value){
var record = combo.findRecord(combo.{@link #valueField}, value);
return record ? record.get(combo.{@link #displayField}) : combo.{@link #valueNotFoundText};
}
}
// create the combo instance
var combo = new Ext.form.ComboBox({
{@link #typeAhead}: true,
{@link #triggerAction}: 'all',
{@link #lazyRender}:true,
{@link #mode}: 'local',
{@link #store}: new Ext.data.ArrayStore({
id: 0,
fields: [
'myId',
'displayText'
],
data: [[1, 'item1'], [2, 'item2']]
}),
{@link #valueField}: 'myId',
{@link #displayField}: 'displayText'
});
// snippet of column model used within grid
var cm = new Ext.grid.ColumnModel([{
...
},{
header: "Some Header",
dataIndex: 'whatever',
width: 130,
editor: combo, // specify reference to combo instance
renderer: Ext.util.Format.comboRenderer(combo) // pass combo instance to reusable renderer
},
...
( run in 0.977 second using v1.01-cache-2.11-cpan-411bb0df24b )