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.

138 lines
4.1 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. Ext.form.Field.prototype.msgTarget = 'side';
  18. /*
  19. * Ext.ux.form.MultiSelect Example Code
  20. */
  21. var msForm = new Ext.form.FormPanel({
  22. title: 'MultiSelect Test',
  23. width: 700,
  24. bodyStyle: 'padding:10px;',
  25. renderTo: 'multiselect',
  26. items:[{
  27. xtype: 'multiselect',
  28. fieldLabel: 'Multiselect<br />(Required)',
  29. name: 'multiselect',
  30. width: 250,
  31. height: 200,
  32. allowBlank:false,
  33. store: [[123,'One Hundred Twenty Three'],
  34. ['1', 'One'], ['2', 'Two'], ['3', 'Three'], ['4', 'Four'], ['5', 'Five'],
  35. ['6', 'Six'], ['7', 'Seven'], ['8', 'Eight'], ['9', 'Nine']],
  36. tbar:[{
  37. text: 'clear',
  38. handler: function(){
  39. msForm.getForm().findField('multiselect').reset();
  40. }
  41. }],
  42. ddReorder: true
  43. }],
  44. tbar:[{
  45. text: 'Options',
  46. menu: [{
  47. text: 'Set Value (2,3)',
  48. handler: function(){
  49. msForm.getForm().findField('multiselect').setValue('2,3');
  50. }
  51. },{
  52. text: 'Toggle Enabled',
  53. handler: function(){
  54. var m = msForm.getForm().findField('multiselect');
  55. if (!m.disabled) {
  56. m.disable();
  57. } else {
  58. m.enable();
  59. }
  60. }
  61. }]
  62. }],
  63. buttons: [{
  64. text: 'Save',
  65. handler: function(){
  66. if(msForm.getForm().isValid()){
  67. Ext.Msg.alert('Submitted Values', 'The following will be sent to the server: <br />'+
  68. msForm.getForm().getValues(true));
  69. }
  70. }
  71. }]
  72. });
  73. var ds = new Ext.data.ArrayStore({
  74. data: [[123,'One Hundred Twenty Three'],
  75. ['1', 'One'], ['2', 'Two'], ['3', 'Three'], ['4', 'Four'], ['5', 'Five'],
  76. ['6', 'Six'], ['7', 'Seven'], ['8', 'Eight'], ['9', 'Nine']],
  77. fields: ['value','text'],
  78. sortInfo: {
  79. field: 'value',
  80. direction: 'ASC'
  81. }
  82. });
  83. /*
  84. * Ext.ux.form.ItemSelector Example Code
  85. */
  86. var isForm = new Ext.form.FormPanel({
  87. title: 'ItemSelector Test',
  88. width:700,
  89. bodyStyle: 'padding:10px;',
  90. renderTo: 'itemselector',
  91. items:[{
  92. xtype: 'itemselector',
  93. name: 'itemselector',
  94. fieldLabel: 'ItemSelector',
  95. imagePath: '../ux/images/',
  96. multiselects: [{
  97. width: 250,
  98. height: 200,
  99. store: ds,
  100. displayField: 'text',
  101. valueField: 'value'
  102. },{
  103. width: 250,
  104. height: 200,
  105. store: [['10','Ten']],
  106. tbar:[{
  107. text: 'clear',
  108. handler:function(){
  109. isForm.getForm().findField('itemselector').reset();
  110. }
  111. }]
  112. }]
  113. }],
  114. buttons: [{
  115. text: 'Save',
  116. handler: function(){
  117. if(isForm.getForm().isValid()){
  118. Ext.Msg.alert('Submitted Values', 'The following will be sent to the server: <br />'+
  119. isForm.getForm().getValues(true));
  120. }
  121. }
  122. }]
  123. });
  124. });