| 10 | | return this.resizeEl; |
|---|
| | 7 | //this.el.addClass('x-hidden'); |
|---|
| | 8 | this.innerWrap = this.el.wrap({ |
|---|
| | 9 | //tabIndex: this.tabIndex, |
|---|
| | 10 | cls: this.baseCls+'-wrap-inner' |
|---|
| | 11 | }); |
|---|
| | 12 | this.wrap = this.innerWrap.wrap({cls: this.baseCls+'-wrap'}); |
|---|
| | 13 | this.imageEl = this.innerWrap.createChild({ |
|---|
| | 14 | tag: 'img', |
|---|
| | 15 | src: Ext.BLANK_IMAGE_URL, |
|---|
| | 16 | cls: this.baseCls |
|---|
| | 17 | }); |
|---|
| | 18 | if(this.boxLabel){ |
|---|
| | 19 | this.labelEl = this.innerWrap.createChild({ |
|---|
| | 20 | tag: 'label', |
|---|
| | 21 | htmlFor: this.el.id, |
|---|
| | 22 | cls: 'x-form-cb-label', |
|---|
| | 23 | html: this.boxLabel |
|---|
| | 24 | }); |
|---|
| | 25 | } |
|---|
| | 26 | //this.imageEl = this.innerWrap.createChild({ |
|---|
| | 27 | //tag: 'img', |
|---|
| | 28 | //src: Ext.BLANK_IMAGE_URL, |
|---|
| | 29 | //cls: this.baseCls |
|---|
| | 30 | //}, this.el); |
|---|
| | 31 | if(this.checked){ |
|---|
| | 32 | this.setValue(true); |
|---|
| | 33 | }else{ |
|---|
| | 34 | this.checked = this.el.dom.checked; |
|---|
| | 35 | } |
|---|
| | 36 | this.originalValue = this.checked; |
|---|
| 20 | | |
|---|
| 21 | | reset : function() |
|---|
| 22 | | { |
|---|
| 23 | | this.fireEvent('reset', this); |
|---|
| | 43 | initCheckEvents: function(){ |
|---|
| | 44 | //this.innerWrap.removeAllListeners(); |
|---|
| | 45 | this.innerWrap.addClassOnOver(this.overCls); |
|---|
| | 46 | this.innerWrap.addClassOnClick(this.mouseDownCls); |
|---|
| | 47 | this.innerWrap.on('click', this.onClick, this); |
|---|
| | 48 | //this.innerWrap.on('keyup', this.onKeyUp, this); |
|---|
| | 49 | }, |
|---|
| | 50 | onFocus: function(e) { |
|---|
| | 51 | Ext.form.Checkbox.superclass.onFocus.call(this, e); |
|---|
| | 52 | //this.el.addClass(this.focusCls); |
|---|
| | 53 | this.innerWrap.addClass(this.focusCls); |
|---|
| | 54 | }, |
|---|
| | 55 | onBlur: function(e) { |
|---|
| | 56 | Ext.form.Checkbox.superclass.onBlur.call(this, e); |
|---|
| | 57 | //this.el.removeClass(this.focusCls); |
|---|
| | 58 | this.innerWrap.removeClass(this.focusCls); |
|---|
| | 59 | }, |
|---|
| | 60 | onClick: function(e){ |
|---|
| | 61 | if (e.getTarget().htmlFor != this.el.dom.id) { |
|---|
| | 62 | if (e.getTarget() !== this.el.dom) { |
|---|
| | 63 | this.el.focus(); |
|---|
| | 64 | } |
|---|
| | 65 | if (!this.disabled && !this.readOnly) { |
|---|
| | 66 | this.toggleValue(); |
|---|
| | 67 | } |
|---|
| | 68 | } |
|---|
| | 69 | //e.stopEvent(); |
|---|
| | 70 | }, |
|---|
| | 71 | onEnable: Ext.form.Checkbox.superclass.onEnable, |
|---|
| | 72 | onDisable: Ext.form.Checkbox.superclass.onDisable, |
|---|
| | 73 | onKeyUp: undefined, |
|---|
| | 74 | setValue: function(v) { |
|---|
| | 75 | var checked = this.checked; |
|---|
| | 76 | this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on'); |
|---|
| | 77 | if(this.rendered){ |
|---|
| | 78 | this.el.dom.checked = this.checked; |
|---|
| | 79 | this.el.dom.defaultChecked = this.checked; |
|---|
| | 80 | //this.wrap[this.checked ? 'addClass' : 'removeClass'](this.checkedCls); |
|---|
| | 81 | this.imageEl[this.checked ? 'addClass' : 'removeClass'](this.checkedCls); |
|---|
| | 82 | } |
|---|
| | 83 | if(checked != this.checked){ |
|---|
| | 84 | this.fireEvent("check", this, this.checked); |
|---|
| | 85 | if(this.handler){ |
|---|
| | 86 | this.handler.call(this.scope || this, this, this.checked); |
|---|
| | 87 | } |
|---|
| | 88 | } |
|---|
| | 89 | }, |
|---|
| | 90 | getResizeEl: function() { |
|---|
| | 91 | //if(!this.resizeEl){ |
|---|
| | 92 | //this.resizeEl = Ext.isSafari ? this.wrap : (this.wrap.up('.x-form-element', 5) || this.wrap); |
|---|
| | 93 | //} |
|---|
| | 94 | //return this.resizeEl; |
|---|
| | 95 | return this.wrap; |
|---|