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.

90 lines
3.2 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.Radio"></div>/**
  16. * @class Ext.form.Radio
  17. * @extends Ext.form.Checkbox
  18. * Single radio field. Same as Checkbox, but provided as a convenience for automatically setting the input type.
  19. * Radio grouping is handled automatically by the browser if you give each radio in a group the same name.
  20. * @constructor
  21. * Creates a new Radio
  22. * @param {Object} config Configuration options
  23. * @xtype radio
  24. */
  25. Ext.form.Radio = Ext.extend(Ext.form.Checkbox, {
  26. inputType: 'radio',
  27. <div id="method-Ext.form.Radio-markInvalid"></div>/**
  28. * Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide
  29. * @method
  30. */
  31. markInvalid : Ext.emptyFn,
  32. <div id="method-Ext.form.Radio-clearInvalid"></div>/**
  33. * Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide
  34. * @method
  35. */
  36. clearInvalid : Ext.emptyFn,
  37. <div id="method-Ext.form.Radio-getGroupValue"></div>/**
  38. * If this radio is part of a group, it will return the selected value
  39. * @return {String}
  40. */
  41. getGroupValue : function(){
  42. var p = this.el.up('form') || Ext.getBody();
  43. var c = p.child('input[name='+this.el.dom.name+']:checked', true);
  44. return c ? c.value : null;
  45. },
  46. <div id="method-Ext.form.Radio-setValue"></div>/**
  47. * Sets either the checked/unchecked status of this Radio, or, if a string value
  48. * is passed, checks a sibling Radio of the same name whose value is the value specified.
  49. * @param value {String/Boolean} Checked value, or the value of the sibling radio button to check.
  50. * @return {Ext.form.Field} this
  51. */
  52. setValue : function(v){
  53. var checkEl,
  54. els,
  55. radio;
  56. if (typeof v == 'boolean') {
  57. Ext.form.Radio.superclass.setValue.call(this, v);
  58. } else if (this.rendered) {
  59. checkEl = this.getCheckEl();
  60. radio = checkEl.child('input[name=' + this.el.dom.name + '][value=' + v + ']', true);
  61. if(radio){
  62. Ext.getCmp(radio.id).setValue(true);
  63. }
  64. }
  65. if(this.rendered && this.checked){
  66. checkEl = checkEl || this.getCheckEl();
  67. els = this.getCheckEl().select('input[name=' + this.el.dom.name + ']');
  68. els.each(function(el){
  69. if(el.dom.id != this.id){
  70. Ext.getCmp(el.dom.id).setValue(false);
  71. }
  72. }, this);
  73. }
  74. return this;
  75. },
  76. // private
  77. getCheckEl: function(){
  78. if(this.inGroup){
  79. return this.el.up('.x-form-radio-group');
  80. }
  81. return this.el.up('form') || Ext.getBody();
  82. }
  83. });
  84. Ext.reg('radio', Ext.form.Radio);
  85. </pre>
  86. </body>
  87. </html>