Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / examples / form / combos.js
index 680a548..55e5e69 100644 (file)
-/*\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
-\r
-Ext.onReady(function(){\r
-    Ext.QuickTips.init();\r
-\r
-    // simple array store\r
-    var store = new Ext.data.SimpleStore({\r
-        fields: ['abbr', 'state', 'nick'],\r
-        data : Ext.exampledata.states // from states.js\r
-    });\r
-    var combo = new Ext.form.ComboBox({\r
-        store: store,\r
-        displayField:'state',\r
-        typeAhead: true,\r
-        mode: 'local',\r
-        forceSelection: true,\r
-        triggerAction: 'all',\r
-        emptyText:'Select a state...',\r
-        selectOnFocus:true,\r
-        applyTo: 'local-states'\r
-    });\r
-    \r
-    //Simple arrays can be used directly as the store config.  1-dimensional arrays\r
-    //will automatically be expanded (each array item will be the combo value and text)\r
-    //and for multi-dimensional arrays, the value in index 0 of each item will be assumed\r
-    //to be the value, while the value at index 1 is assumed to be the text.  For example,\r
-    //[['AL', 'Alabama'],['AK', 'Alaska'], etc.]. Any other values beyond index 1 within\r
-    //each item will be ignored using this approach.\r
-       var comboFromArray = new Ext.form.ComboBox({\r
-           store: Ext.exampledata.states,\r
-           typeAhead: true,\r
-        forceSelection: true,\r
-           triggerAction: 'all',\r
-           emptyText:'Select a state...',\r
-           selectOnFocus:true,\r
-           applyTo: 'array-states'\r
-       });\r
-\r
-    var comboWithTooltip = new Ext.form.ComboBox({\r
-        tpl: '<tpl for="."><div ext:qtip="{state}. {nick}" class="x-combo-list-item">{state}</div></tpl>',\r
-        store: store,\r
-        displayField:'state',\r
-        typeAhead: true,\r
-        forceSelection: true,\r
-        mode: 'local',\r
-        triggerAction: 'all',\r
-        emptyText:'Select a state...',\r
-        selectOnFocus:true,\r
-        applyTo: 'local-states-with-qtip'\r
-    });\r
-\r
-    var converted = new Ext.form.ComboBox({\r
-        typeAhead: true,\r
-        triggerAction: 'all',\r
-        transform:'state',\r
-        width:135,\r
-        forceSelection:true\r
-    });\r
-    \r
-//  Create code view Panels. Ignore.\r
-    new Ext.Panel({\r
-       contentEl: 'state-combo-code',\r
-       width: Ext.getBody().child('p').getWidth(),\r
-       title: 'View code to create this combo',\r
-       hideCollapseTool: true,\r
-       titleCollapse: true,\r
-       collapsible: true,\r
-       collapsed: true,\r
-       renderTo: 'state-combo-code-panel'\r
-    });\r
-    new Ext.Panel({\r
-       contentEl: 'state-combo-qtip-code',\r
-       autoScroll: true,\r
-       width: Ext.getBody().child('p').getWidth(),\r
-       title: 'View code to create this combo',\r
-       hideCollapseTool: true,\r
-       titleCollapse: true,\r
-       collapsible: true,\r
-       collapsed: true,\r
-       renderTo: 'state-combo-qtip-code-panel'\r
-    });\r
-    new Ext.Panel({\r
-       contentEl: 'array-combo-code',\r
-       autoScroll: true,\r
-       width: Ext.getBody().child('p').getWidth(),\r
-       title: 'View code to create this combo',\r
-       hideCollapseTool: true,\r
-       titleCollapse: true,\r
-       collapsible: true,\r
-       collapsed: true,\r
-       renderTo: 'array-combo-code-panel'\r
-    });\r
-    new Ext.Panel({\r
-       contentEl: 'transformed-combo-code',\r
-       autoScroll: true,\r
-       width: Ext.getBody().child('p').getWidth(),\r
-       title: 'View code to create this combo',\r
-       hideCollapseTool: true,\r
-       titleCollapse: true,\r
-       collapsible: true,\r
-       collapsed: true,\r
-       renderTo: 'transformed-combo-code-panel'\r
-    });\r
-\r
+/*!
+ * Ext JS Library 3.0.0
+ * Copyright(c) 2006-2009 Ext JS, LLC
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+Ext.onReady(function(){
+    Ext.QuickTips.init();
+
+    // simple array store
+    var store = new Ext.data.ArrayStore({
+        fields: ['abbr', 'state', 'nick'],
+        data : Ext.exampledata.states // from states.js
+    });
+    var combo = new Ext.form.ComboBox({
+        store: store,
+        displayField:'state',
+        typeAhead: true,
+        mode: 'local',
+        forceSelection: true,
+        triggerAction: 'all',
+        emptyText:'Select a state...',
+        selectOnFocus:true,
+        applyTo: 'local-states'
+    });
+    
+    //Simple arrays can be used directly as the store config.  1-dimensional arrays
+    //will automatically be expanded (each array item will be the combo value and text)
+    //and for multi-dimensional arrays, the value in index 0 of each item will be assumed
+    //to be the value, while the value at index 1 is assumed to be the text.  For example,
+    //[['AL', 'Alabama'],['AK', 'Alaska'], etc.]. Any other values beyond index 1 within
+    //each item will be ignored using this approach.
+    var comboFromArray = new Ext.form.ComboBox({
+        store: Ext.exampledata.states,
+        typeAhead: true,
+        forceSelection: true,
+        triggerAction: 'all',
+        emptyText:'Select a state...',
+        selectOnFocus:true,
+        applyTo: 'array-states'
+    });
+
+    var comboWithTooltip = new Ext.form.ComboBox({
+        tpl: '<tpl for="."><div ext:qtip="{state}. {nick}" class="x-combo-list-item">{state}</div></tpl>',
+        store: store,
+        displayField:'state',
+        typeAhead: true,
+        forceSelection: true,
+        mode: 'local',
+        triggerAction: 'all',
+        emptyText:'Select a state...',
+        selectOnFocus:true,
+        applyTo: 'local-states-with-qtip'
+    });
+
+    var converted = new Ext.form.ComboBox({
+        typeAhead: true,
+        triggerAction: 'all',
+        transform:'state',
+        width:135,
+        forceSelection:true
+    });
+    
+//  Create code view Panels. Ignore.
+    new Ext.Panel({
+       contentEl: 'state-combo-code',
+       width: Ext.getBody().child('p').getWidth(),
+       title: 'View code to create this combo',
+       hideCollapseTool: true,
+       titleCollapse: true,
+       collapsible: true,
+       collapsed: true,
+       renderTo: 'state-combo-code-panel'
+    });
+    new Ext.Panel({
+       contentEl: 'state-combo-qtip-code',
+       autoScroll: true,
+       width: Ext.getBody().child('p').getWidth(),
+       title: 'View code to create this combo',
+       hideCollapseTool: true,
+       titleCollapse: true,
+       collapsible: true,
+       collapsed: true,
+       renderTo: 'state-combo-qtip-code-panel'
+    });
+    new Ext.Panel({
+       contentEl: 'array-combo-code',
+       autoScroll: true,
+       width: Ext.getBody().child('p').getWidth(),
+       title: 'View code to create this combo',
+       hideCollapseTool: true,
+       titleCollapse: true,
+       collapsible: true,
+       collapsed: true,
+       renderTo: 'array-combo-code-panel'
+    });
+    new Ext.Panel({
+       contentEl: 'transformed-combo-code',
+       autoScroll: true,
+       width: Ext.getBody().child('p').getWidth(),
+       title: 'View code to create this combo',
+       hideCollapseTool: true,
+       titleCollapse: true,
+       collapsible: true,
+       collapsed: true,
+       renderTo: 'transformed-combo-code-panel'
+    });
+
 });
\ No newline at end of file