git.ithinksw.org
/
extjs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Upgrade to ExtJS 3.3.1 - Released 11/30/2010
[extjs.git]
/
src
/
widgets
/
form
/
Checkbox.js
diff --git
a/src/widgets/form/Checkbox.js
b/src/widgets/form/Checkbox.js
index
5f42406
..
b4a8c4e
100644
(file)
--- a/
src/widgets/form/Checkbox.js
+++ b/
src/widgets/form/Checkbox.js
@@
-1,8
+1,8
@@
/*!
/*!
- * Ext JS Library 3.
0.0
- * Copyright(c) 2006-20
09 Ext JS, LLC
- * licensing@
extjs
.com
- * http://www.
extjs
.com/license
+ * Ext JS Library 3.
3.1
+ * Copyright(c) 2006-20
10 Sencha Inc.
+ * licensing@
sencha
.com
+ * http://www.
sencha
.com/license
*/
/**
* @class Ext.form.Checkbox
*/
/**
* @class Ext.form.Checkbox
@@
-26,19
+26,20
@@
Ext.form.Checkbox = Ext.extend(Ext.form.Field, {
* @cfg {Boolean} checked <tt>true</tt> if the checkbox should render initially checked (defaults to <tt>false</tt>)
*/
checked : false,
* @cfg {Boolean} checked <tt>true</tt> if the checkbox should render initially checked (defaults to <tt>false</tt>)
*/
checked : false,
+ /**
+ * @cfg {String} boxLabel The text that appears beside the checkbox
+ */
+ boxLabel: ' ',
/**
* @cfg {String/Object} autoCreate A DomHelper element spec, or true for a default element spec (defaults to
* {tag: 'input', type: 'checkbox', autocomplete: 'off'})
*/
defaultAutoCreate : { tag: 'input', type: 'checkbox', autocomplete: 'off'},
/**
* @cfg {String/Object} autoCreate A DomHelper element spec, or true for a default element spec (defaults to
* {tag: 'input', type: 'checkbox', autocomplete: 'off'})
*/
defaultAutoCreate : { tag: 'input', type: 'checkbox', autocomplete: 'off'},
- /**
- * @cfg {String} boxLabel The text that appears beside the checkbox
- */
/**
* @cfg {String} inputValue The value that should go into the generated input element's value attribute
*/
/**
/**
* @cfg {String} inputValue The value that should go into the generated input element's value attribute
*/
/**
- * @cfg {Function} handler A function called when the {@link #checked} value changes (can be used instead of
+ * @cfg {Function} handler A function called when the {@link #checked} value changes (can be used instead of
* handling the check event). The handler is passed the following parameters:
* <div class="mdetail-params"><ul>
* <li><b>checkbox</b> : Ext.form.Checkbox<div class="sub-desc">The Checkbox being toggled.</div></li>
* handling the check event). The handler is passed the following parameters:
* <div class="mdetail-params"><ul>
* <li><b>checkbox</b> : Ext.form.Checkbox<div class="sub-desc">The Checkbox being toggled.</div></li>
@@
-52,7
+53,7
@@
Ext.form.Checkbox = Ext.extend(Ext.form.Field, {
// private
actionMode : 'wrap',
// private
actionMode : 'wrap',
-
+
// private
initComponent : function(){
Ext.form.Checkbox.superclass.initComponent.call(this);
// private
initComponent : function(){
Ext.form.Checkbox.superclass.initComponent.call(this);
@@
-78,18
+79,11
@@
Ext.form.Checkbox = Ext.extend(Ext.form.Field, {
// private
initEvents : function(){
Ext.form.Checkbox.superclass.initEvents.call(this);
// private
initEvents : function(){
Ext.form.Checkbox.superclass.initEvents.call(this);
- this.mon(this.el, 'click', this.onClick, this);
- this.mon(this.el, 'change', this.onClick, this);
- },
-
- // private
- getResizeEl : function(){
- return this.wrap;
- },
-
- // private
- getPositionEl : function(){
- return this.wrap;
+ this.mon(this.el, {
+ scope: this,
+ click: this.onClick,
+ change: this.onClick
+ });
},
/**
},
/**
@@
-120,6
+114,11
@@
Ext.form.Checkbox = Ext.extend(Ext.form.Field, {
}else{
this.checked = this.el.dom.checked;
}
}else{
this.checked = this.el.dom.checked;
}
+ // Need to repaint for IE, otherwise positioning is broken
+ if (Ext.isIE && !Ext.isStrict) {
+ this.wrap.repaint();
+ }
+ this.resizeEl = this.positionEl = this.wrap;
},
// private
},
// private
@@
-141,7
+140,7
@@
Ext.form.Checkbox = Ext.extend(Ext.form.Field, {
if(this.rendered){
return this.el.dom.checked;
}
if(this.rendered){
return this.el.dom.checked;
}
- return
false
;
+ return
this.checked
;
},
// private
},
// private
@@
-159,8
+158,10
@@
Ext.form.Checkbox = Ext.extend(Ext.form.Field, {
* @return {Ext.form.Field} this
*/
setValue : function(v){
* @return {Ext.form.Field} this
*/
setValue : function(v){
- var checked = this.checked ;
- this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on');
+ var checked = this.checked,
+ inputVal = this.inputValue;
+
+ this.checked = (v === true || v === 'true' || v == '1' || (inputVal ? v == inputVal : String(v).toLowerCase() == 'on'));
if(this.rendered){
this.el.dom.checked = this.checked;
this.el.dom.defaultChecked = this.checked;
if(this.rendered){
this.el.dom.checked = this.checked;
this.el.dom.defaultChecked = this.checked;