Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / examples / ux / SelectBox.js
similarity index 76%
rename from examples/form/SelectBox.js
rename to examples/ux/SelectBox.js
index 909e929..b8b5ae3 100644 (file)
@@ -1,44 +1,43 @@
-/*\r
- * Ext JS Library 2.2.1\r
- * Copyright(c) 2006-2009, Ext JS, LLC.\r
- * licensing@extjs.com\r
- * \r
- * http://extjs.com/license\r
- */\r
+/*!
+ * 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');\r
 \r
 /**\r
- * Makes a ComboBox more closely mimic an HTML SELECT.  Supports clicking and dragging\r
+ * @class Ext.ux.form.SelectBox\r
+ * @extends Ext.form.ComboBox\r
+ * <p>Makes a ComboBox more closely mimic an HTML SELECT.  Supports clicking and dragging\r
  * through the list, with item selection occurring when the mouse button is released.\r
  * When used will automatically set {@link #editable} to false and call {@link Ext.Element#unselectable}\r
- * on inner elements.  Re-enabling editable after calling this will NOT work.\r
- *\r
- * @author Corey Gilmore\r
- * http://extjs.com/forum/showthread.php?t=6392\r
- * \r
+ * on inner elements.  Re-enabling editable after calling this will NOT work.</p>\r
+ * @author Corey Gilmore http://extjs.com/forum/showthread.php?t=6392\r
  * @history 2007-07-08 jvs\r
  * Slight mods for Ext 2.0\r
+ * @xtype selectbox\r
  */\r
-Ext.ux.SelectBox = function(config){\r
-       this.searchResetDelay = 1000;\r
-       config = config || {};\r
-       config = Ext.apply(config || {}, {\r
-               editable: false,\r
-               forceSelection: true,\r
-               rowHeight: false,\r
-               lastSearchTerm: false,\r
-        triggerAction: 'all',\r
-        mode: 'local'\r
-    });\r
-\r
-       Ext.ux.SelectBox.superclass.constructor.apply(this, arguments);\r
-\r
-       this.lastSelectedIndex = this.selectedIndex || 0;\r
-};\r
-\r
-Ext.extend(Ext.ux.SelectBox, Ext.form.ComboBox, {\r
+Ext.ux.form.SelectBox = Ext.extend(Ext.form.ComboBox, {\r
+       constructor: function(config){\r
+               this.searchResetDelay = 1000;\r
+               config = config || {};\r
+               config = Ext.apply(config || {}, {\r
+                       editable: false,\r
+                       forceSelection: true,\r
+                       rowHeight: false,\r
+                       lastSearchTerm: false,\r
+                       triggerAction: 'all',\r
+                       mode: 'local'\r
+               });\r
+\r
+               Ext.ux.form.SelectBox.superclass.constructor.apply(this, arguments);\r
+\r
+               this.lastSelectedIndex = this.selectedIndex || 0;\r
+       },\r
 \r
        initEvents : function(){\r
-               Ext.ux.SelectBox.superclass.initEvents.apply(this, arguments);\r
+               Ext.ux.form.SelectBox.superclass.initEvents.apply(this, arguments);\r
                // you need to use keypress to capture upper/lower case and shift+key, but it doesn't work in IE\r
                this.el.on('keydown', this.keySearch, this, true);\r
                this.cshTask = new Ext.util.DelayedTask(this.clearSearchHistory, this);\r
@@ -88,7 +87,7 @@ Ext.extend(Ext.ux.SelectBox, Ext.form.ComboBox, {
 \r
        onRender : function(ct, position) {\r
                this.store.on('load', this.calcRowsPerPage, this);\r
-               Ext.ux.SelectBox.superclass.onRender.apply(this, arguments);\r
+               Ext.ux.form.SelectBox.superclass.onRender.apply(this, arguments);\r
                if( this.mode == 'local' ) {\r
                        this.calcRowsPerPage();\r
                }\r
@@ -106,7 +105,7 @@ Ext.extend(Ext.ux.SelectBox, Ext.form.ComboBox, {
        },\r
 \r
        render : function(ct) {\r
-               Ext.ux.SelectBox.superclass.render.apply(this, arguments);\r
+               Ext.ux.form.SelectBox.superclass.render.apply(this, arguments);\r
                if( Ext.isSafari ) {\r
                        this.el.swallowEvent('mousedown', true);\r
                }\r
@@ -196,4 +195,9 @@ Ext.extend(Ext.ux.SelectBox, Ext.form.ComboBox, {
                }\r
        }\r
 \r
-});
\ No newline at end of file
+});\r
+\r
+Ext.reg('selectbox', Ext.ux.form.SelectBox);\r
+\r
+//backwards compat\r
+Ext.ux.SelectBox = Ext.ux.form.SelectBox;\r