You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
3.9 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. This file is part of Ext JS 3.4
  3. Copyright (c) 2011-2013 Sencha Inc
  4. Contact: http://www.sencha.com/contact
  5. GNU General Public License Usage
  6. This file may be used under the terms of the GNU General Public License version 3.0 as
  7. published by the Free Software Foundation and appearing in the file LICENSE included in the
  8. packaging of this file.
  9. Please review the following information to ensure the GNU General Public License version 3.0
  10. requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  11. If you are unsure which license is appropriate for your use, please contact the sales department
  12. at http://www.sencha.com/contact.
  13. Build date: 2013-04-03 15:07:25
  14. */
  15. Ext.onReady(function(){
  16. Ext.QuickTips.init();
  17. // simple array store
  18. var store = new Ext.data.ArrayStore({
  19. fields: ['abbr', 'state', 'nick'],
  20. data : Ext.exampledata.states // from states.js
  21. });
  22. var combo = new Ext.form.ComboBox({
  23. store: store,
  24. displayField:'state',
  25. typeAhead: true,
  26. mode: 'local',
  27. forceSelection: true,
  28. triggerAction: 'all',
  29. emptyText:'Select a state...',
  30. selectOnFocus:true,
  31. applyTo: 'local-states'
  32. });
  33. //Simple arrays can be used directly as the store config. 1-dimensional arrays
  34. //will automatically be expanded (each array item will be the combo value and text)
  35. //and for multi-dimensional arrays, the value in index 0 of each item will be assumed
  36. //to be the value, while the value at index 1 is assumed to be the text. For example,
  37. //[['AL', 'Alabama'],['AK', 'Alaska'], etc.]. Any other values beyond index 1 within
  38. //each item will be ignored using this approach.
  39. var comboFromArray = new Ext.form.ComboBox({
  40. store: Ext.exampledata.states,
  41. typeAhead: true,
  42. forceSelection: true,
  43. triggerAction: 'all',
  44. emptyText:'Select a state...',
  45. selectOnFocus:true,
  46. applyTo: 'array-states'
  47. });
  48. var comboWithTooltip = new Ext.form.ComboBox({
  49. tpl: '<tpl for="."><div ext:qtip="{state}. {nick}" class="x-combo-list-item">{state}</div></tpl>',
  50. store: store,
  51. displayField:'state',
  52. typeAhead: true,
  53. forceSelection: true,
  54. mode: 'local',
  55. triggerAction: 'all',
  56. emptyText:'Select a state...',
  57. selectOnFocus:true,
  58. applyTo: 'local-states-with-qtip'
  59. });
  60. var converted = new Ext.form.ComboBox({
  61. typeAhead: true,
  62. triggerAction: 'all',
  63. transform:'state',
  64. width:135,
  65. forceSelection:true
  66. });
  67. // Create code view Panels. Ignore.
  68. new Ext.Panel({
  69. contentEl: 'state-combo-code',
  70. width: Ext.getBody().child('p').getWidth(),
  71. title: 'View code to create this combo',
  72. hideCollapseTool: true,
  73. titleCollapse: true,
  74. collapsible: true,
  75. collapsed: true,
  76. renderTo: 'state-combo-code-panel'
  77. });
  78. new Ext.Panel({
  79. contentEl: 'state-combo-qtip-code',
  80. autoScroll: true,
  81. width: Ext.getBody().child('p').getWidth(),
  82. title: 'View code to create this combo',
  83. hideCollapseTool: true,
  84. titleCollapse: true,
  85. collapsible: true,
  86. collapsed: true,
  87. renderTo: 'state-combo-qtip-code-panel'
  88. });
  89. new Ext.Panel({
  90. contentEl: 'array-combo-code',
  91. autoScroll: true,
  92. width: Ext.getBody().child('p').getWidth(),
  93. title: 'View code to create this combo',
  94. hideCollapseTool: true,
  95. titleCollapse: true,
  96. collapsible: true,
  97. collapsed: true,
  98. renderTo: 'array-combo-code-panel'
  99. });
  100. new Ext.Panel({
  101. contentEl: 'transformed-combo-code',
  102. autoScroll: true,
  103. width: Ext.getBody().child('p').getWidth(),
  104. title: 'View code to create this combo',
  105. hideCollapseTool: true,
  106. titleCollapse: true,
  107. collapsible: true,
  108. collapsed: true,
  109. renderTo: 'transformed-combo-code-panel'
  110. });
  111. });