X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/ee06f37b0f6f6d94cd05a6ffae556660f7c4a2bc:/examples/form/SelectBox.js..c930e9176a5a85509c5b0230e2bff5c22a591432:/examples/ux/SelectBox.js diff --git a/examples/form/SelectBox.js b/examples/ux/SelectBox.js similarity index 76% rename from examples/form/SelectBox.js rename to examples/ux/SelectBox.js index 909e9292..b8b5ae3e 100644 --- a/examples/form/SelectBox.js +++ b/examples/ux/SelectBox.js @@ -1,44 +1,43 @@ -/* - * Ext JS Library 2.2.1 - * Copyright(c) 2006-2009, Ext JS, LLC. - * licensing@extjs.com - * - * http://extjs.com/license - */ +/*! + * Ext JS Library 3.0.0 + * Copyright(c) 2006-2009 Ext JS, LLC + * licensing@extjs.com + * http://www.extjs.com/license + */ +Ext.ns('Ext.ux.form'); /** - * Makes a ComboBox more closely mimic an HTML SELECT. Supports clicking and dragging + * @class Ext.ux.form.SelectBox + * @extends Ext.form.ComboBox + *

Makes a ComboBox more closely mimic an HTML SELECT. Supports clicking and dragging * through the list, with item selection occurring when the mouse button is released. * When used will automatically set {@link #editable} to false and call {@link Ext.Element#unselectable} - * on inner elements. Re-enabling editable after calling this will NOT work. - * - * @author Corey Gilmore - * http://extjs.com/forum/showthread.php?t=6392 - * + * on inner elements. Re-enabling editable after calling this will NOT work.

+ * @author Corey Gilmore http://extjs.com/forum/showthread.php?t=6392 * @history 2007-07-08 jvs * Slight mods for Ext 2.0 + * @xtype selectbox */ -Ext.ux.SelectBox = function(config){ - this.searchResetDelay = 1000; - config = config || {}; - config = Ext.apply(config || {}, { - editable: false, - forceSelection: true, - rowHeight: false, - lastSearchTerm: false, - triggerAction: 'all', - mode: 'local' - }); - - Ext.ux.SelectBox.superclass.constructor.apply(this, arguments); - - this.lastSelectedIndex = this.selectedIndex || 0; -}; - -Ext.extend(Ext.ux.SelectBox, Ext.form.ComboBox, { +Ext.ux.form.SelectBox = Ext.extend(Ext.form.ComboBox, { + constructor: function(config){ + this.searchResetDelay = 1000; + config = config || {}; + config = Ext.apply(config || {}, { + editable: false, + forceSelection: true, + rowHeight: false, + lastSearchTerm: false, + triggerAction: 'all', + mode: 'local' + }); + + Ext.ux.form.SelectBox.superclass.constructor.apply(this, arguments); + + this.lastSelectedIndex = this.selectedIndex || 0; + }, initEvents : function(){ - Ext.ux.SelectBox.superclass.initEvents.apply(this, arguments); + Ext.ux.form.SelectBox.superclass.initEvents.apply(this, arguments); // you need to use keypress to capture upper/lower case and shift+key, but it doesn't work in IE this.el.on('keydown', this.keySearch, this, true); this.cshTask = new Ext.util.DelayedTask(this.clearSearchHistory, this); @@ -88,7 +87,7 @@ Ext.extend(Ext.ux.SelectBox, Ext.form.ComboBox, { onRender : function(ct, position) { this.store.on('load', this.calcRowsPerPage, this); - Ext.ux.SelectBox.superclass.onRender.apply(this, arguments); + Ext.ux.form.SelectBox.superclass.onRender.apply(this, arguments); if( this.mode == 'local' ) { this.calcRowsPerPage(); } @@ -106,7 +105,7 @@ Ext.extend(Ext.ux.SelectBox, Ext.form.ComboBox, { }, render : function(ct) { - Ext.ux.SelectBox.superclass.render.apply(this, arguments); + Ext.ux.form.SelectBox.superclass.render.apply(this, arguments); if( Ext.isSafari ) { this.el.swallowEvent('mousedown', true); } @@ -196,4 +195,9 @@ Ext.extend(Ext.ux.SelectBox, Ext.form.ComboBox, { } } -}); \ No newline at end of file +}); + +Ext.reg('selectbox', Ext.ux.form.SelectBox); + +//backwards compat +Ext.ux.SelectBox = Ext.ux.form.SelectBox;