Web Interface For Lite Argus Control modules
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.

132 lines
4.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>The source code</title>
  5. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  6. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  7. </head>
  8. <body onload="prettyPrint();">
  9. <pre class="prettyprint lang-js">/*!
  10. * Ext JS Library 3.3.1
  11. * Copyright(c) 2006-2010 Sencha Inc.
  12. * licensing@sencha.com
  13. * http://www.sencha.com/license
  14. */
  15. <div id="cls-Ext.form.RadioGroup"></div>/**
  16. * @class Ext.form.RadioGroup
  17. * @extends Ext.form.CheckboxGroup
  18. * A grouping container for {@link Ext.form.Radio} controls.
  19. * @constructor
  20. * Creates a new RadioGroup
  21. * @param {Object} config Configuration options
  22. * @xtype radiogroup
  23. */
  24. Ext.form.RadioGroup = Ext.extend(Ext.form.CheckboxGroup, {
  25. <div id="cfg-Ext.form.RadioGroup-items"></div>/**
  26. * @cfg {Array} items An Array of {@link Ext.form.Radio Radio}s or Radio config objects
  27. * to arrange in the group.
  28. */
  29. <div id="cfg-Ext.form.RadioGroup-allowBlank"></div>/**
  30. * @cfg {Boolean} allowBlank True to allow every item in the group to be blank (defaults to true).
  31. * If allowBlank = false and no items are selected at validation time, {@link @blankText} will
  32. * be used as the error text.
  33. */
  34. allowBlank : true,
  35. <div id="cfg-Ext.form.RadioGroup-blankText"></div>/**
  36. * @cfg {String} blankText Error text to display if the {@link #allowBlank} validation fails
  37. * (defaults to 'You must select one item in this group')
  38. */
  39. blankText : 'You must select one item in this group',
  40. // private
  41. defaultType : 'radio',
  42. // private
  43. groupCls : 'x-form-radio-group',
  44. <div id="event-Ext.form.RadioGroup-change"></div>/**
  45. * @event change
  46. * Fires when the state of a child radio changes.
  47. * @param {Ext.form.RadioGroup} this
  48. * @param {Ext.form.Radio} checked The checked radio
  49. */
  50. <div id="method-Ext.form.RadioGroup-getValue"></div>/**
  51. * Gets the selected {@link Ext.form.Radio} in the group, if it exists.
  52. * @return {Ext.form.Radio} The selected radio.
  53. */
  54. getValue : function(){
  55. var out = null;
  56. this.eachItem(function(item){
  57. if(item.checked){
  58. out = item;
  59. return false;
  60. }
  61. });
  62. return out;
  63. },
  64. <div id="method-Ext.form.RadioGroup-onSetValue"></div>/**
  65. * Sets the checked radio in the group.
  66. * @param {String/Ext.form.Radio} id The radio to check.
  67. * @param {Boolean} value The value to set the radio.
  68. * @return {Ext.form.RadioGroup} this
  69. */
  70. onSetValue : function(id, value){
  71. if(arguments.length > 1){
  72. var f = this.getBox(id);
  73. if(f){
  74. f.setValue(value);
  75. if(f.checked){
  76. this.eachItem(function(item){
  77. if (item !== f){
  78. item.setValue(false);
  79. }
  80. });
  81. }
  82. }
  83. }else{
  84. this.setValueForItem(id);
  85. }
  86. },
  87. setValueForItem : function(val){
  88. val = String(val).split(',')[0];
  89. this.eachItem(function(item){
  90. item.setValue(val == item.inputValue);
  91. });
  92. },
  93. // private
  94. fireChecked : function(){
  95. if(!this.checkTask){
  96. this.checkTask = new Ext.util.DelayedTask(this.bufferChecked, this);
  97. }
  98. this.checkTask.delay(10);
  99. },
  100. // private
  101. bufferChecked : function(){
  102. var out = null;
  103. this.eachItem(function(item){
  104. if(item.checked){
  105. out = item;
  106. return false;
  107. }
  108. });
  109. this.fireEvent('change', this, out);
  110. },
  111. onDestroy : function(){
  112. if(this.checkTask){
  113. this.checkTask.cancel();
  114. this.checkTask = null;
  115. }
  116. Ext.form.RadioGroup.superclass.onDestroy.call(this);
  117. }
  118. });
  119. Ext.reg('radiogroup', Ext.form.RadioGroup);
  120. </pre>
  121. </body>
  122. </html>