sync
authorAlan Knowles <alan@akbkhome.com>
Thu, 29 Jul 2010 07:12:17 +0000 (15:12 +0800)
committerAlan Knowles <alan@akbkhome.com>
Thu, 29 Jul 2010 07:12:17 +0000 (15:12 +0800)
roojs-all.js
roojs-debug.js
roojs-ui-debug.js
roojs-ui.js

index a4a798b..727f27a 100644 (file)
@@ -682,7 +682,7 @@ this.onLoad();}else {this.store.baseParams[this.queryParam]=q;this.store.load({p
 this.list.hide();Roo.get(document).un('mousedown',this.collapseIf,this);Roo.get(document).un('mousewheel',this.collapseIf,this);this.fireEvent('collapse',this);},collapseIf:function(e){if(!e.within(this.wrap)&&!e.within(this.list)){this.collapse();}},expand:function(){if(this.isExpanded()||!this.hasFocus){return;}
 this.list.alignTo(this.el,this.listAlign);this.list.show();Roo.get(document).on('mousedown',this.collapseIf,this);Roo.get(document).on('mousewheel',this.collapseIf,this);this.fireEvent('expand',this);},onTriggerClick:function(){if(this.disabled){return;}if(this.isExpanded()){this.collapse();if(!this.blockFocus){this.el.focus();}}else {this.hasFocus=true;if(this.triggerAction=='all'){this.doQuery(this.allQuery,true);}else {this.doQuery(this.getRawValue());}if(!this.blockFocus){this.el.focus();}}}});
 Roo.form.Checkbox=function(A){Roo.form.Checkbox.superclass.constructor.call(this,A);this.addEvents({check:true});};Roo.extend(Roo.form.Checkbox,Roo.form.Field,{focusClass:undefined,fieldClass:"x-form-field",checked:false,defaultAutoCreate:{tag:"input",type:'hidden',autocomplete:"off"},boxLabel:"",inputValue:'1',valueOff:'0',actionMode:'viewEl',itemCls:'x-menu-check-item x-form-item',groupClass:'x-menu-group-item',inputType:'hidden',inSetChecked:false,inputElement:false,basedOn:false,isFormField:true,onResize:function(){Roo.form.Checkbox.superclass.onResize.apply(this,arguments);if(!this.boxLabel){this.el.alignTo(this.wrap,'c-c');}},initEvents:function(){Roo.form.Checkbox.superclass.initEvents.call(this);this.el.on("click",this.onClick,this);this.el.on("change",this.onClick,this);},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},onRender:function(ct,B){Roo.form.Checkbox.superclass.onRender.call(this,ct,B);this.wrap=this.el.wrap({cls:'x-menu-check-item '});var C=this.wrap.createChild({tag:'img',cls:'x-menu-item-icon',style:'margin: 0px;',src:Roo.BLANK_IMAGE_URL});this.viewEl=C;this.wrap.on('click',this.onClick,this);this.el.on('DOMAttrModified',this.setFromHidden,this);this.el.on('propertychange',this.setFromHidden,this);if(this.boxLabel){this.wrap.createChild({tag:'label',htmlFor:this.el.id,cls:'x-form-cb-label',html:this.boxLabel});}
-this.setChecked(this.checked);},initValue:Roo.emptyFn,getValue:function(){if(this.el){return String(this.el.dom.value)==String(this.inputValue)?this.inputValue:this.valueOff;}return this.valueOff;},onClick:function(){this.setChecked(!this.checked);},setValue:function(v,D){this.setChecked(v===this.inputValue);},setChecked:function(E,F){if(this.inSetChecked){this.checked=E;return;}if(this.wrap){this.wrap[E?'addClass':'removeClass']('x-menu-item-checked');}
+this.setChecked(this.checked);},initValue:Roo.emptyFn,getValue:function(){if(this.el){return String(this.el.dom.value)==String(this.inputValue)?this.inputValue:this.valueOff;}return this.valueOff;},onClick:function(){this.setChecked(!this.checked);},setValue:function(v,D){this.setChecked(String(v)===String(this.inputValue),D);},setChecked:function(E,F){if(this.inSetChecked){this.checked=E;return;}if(this.wrap){this.wrap[E?'addClass':'removeClass']('x-menu-item-checked');}
 this.checked=E;if(F!==true){this.fireEvent('checkchange',this,E);}
 this.inSetChecked=true;this.el.dom.value=E?this.inputValue:this.valueOff;this.inSetChecked=false;},setFromHidden:function(){if(!this.el){return;}
 this.setValue(this.el.dom.value);},onDestroy:function(){if(this.viewEl){Roo.get(this.viewEl).remove();}
index 27ba97d..573e675 100644 (file)
@@ -37763,15 +37763,19 @@ Roo.extend(Roo.form.Checkbox, Roo.form.Field,  {
 
     /**
      * Sets the checked state of the checkbox.
-     * @param {Boolean/String} checked True, 'true', '1', or 'on' to check the checkbox, any other value will uncheck it.
+     * On is always based on a string comparison between inputValue and the param.
+     * @param {Boolean/String} value - the value to set 
+     * @param {Boolean/String} suppressEvent - whether to suppress the checkchange event.
      */
     setValue : function(v,suppressEvent){
+        
+        
         //this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on');
         //if(this.el && this.el.dom){
         //    this.el.dom.checked = this.checked;
         //    this.el.dom.defaultChecked = this.checked;
         //}
-        this.setChecked(v === this.inputValue);
+        this.setChecked(String(v) === String(this.inputValue), suppressEvent);
         //this.fireEvent("check", this, this.checked);
     },
     // private..
index 159daa0..709a3f3 100644 (file)
@@ -23431,15 +23431,19 @@ Roo.extend(Roo.form.Checkbox, Roo.form.Field,  {
 
     /**
      * Sets the checked state of the checkbox.
-     * @param {Boolean/String} checked True, 'true', '1', or 'on' to check the checkbox, any other value will uncheck it.
+     * On is always based on a string comparison between inputValue and the param.
+     * @param {Boolean/String} value - the value to set 
+     * @param {Boolean/String} suppressEvent - whether to suppress the checkchange event.
      */
     setValue : function(v,suppressEvent){
+        
+        
         //this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on');
         //if(this.el && this.el.dom){
         //    this.el.dom.checked = this.checked;
         //    this.el.dom.defaultChecked = this.checked;
         //}
-        this.setChecked(v === this.inputValue);
+        this.setChecked(String(v) === String(this.inputValue), suppressEvent);
         //this.fireEvent("check", this, this.checked);
     },
     // private..
index 4dbb7da..9104c7a 100644 (file)
@@ -441,7 +441,7 @@ this.onLoad();}else {this.store.baseParams[this.queryParam]=q;this.store.load({p
 this.list.hide();Roo.get(document).un('mousedown',this.collapseIf,this);Roo.get(document).un('mousewheel',this.collapseIf,this);this.fireEvent('collapse',this);},collapseIf:function(e){if(!e.within(this.wrap)&&!e.within(this.list)){this.collapse();}},expand:function(){if(this.isExpanded()||!this.hasFocus){return;}
 this.list.alignTo(this.el,this.listAlign);this.list.show();Roo.get(document).on('mousedown',this.collapseIf,this);Roo.get(document).on('mousewheel',this.collapseIf,this);this.fireEvent('expand',this);},onTriggerClick:function(){if(this.disabled){return;}if(this.isExpanded()){this.collapse();if(!this.blockFocus){this.el.focus();}}else {this.hasFocus=true;if(this.triggerAction=='all'){this.doQuery(this.allQuery,true);}else {this.doQuery(this.getRawValue());}if(!this.blockFocus){this.el.focus();}}}});
 Roo.form.Checkbox=function(A){Roo.form.Checkbox.superclass.constructor.call(this,A);this.addEvents({check:true});};Roo.extend(Roo.form.Checkbox,Roo.form.Field,{focusClass:undefined,fieldClass:"x-form-field",checked:false,defaultAutoCreate:{tag:"input",type:'hidden',autocomplete:"off"},boxLabel:"",inputValue:'1',valueOff:'0',actionMode:'viewEl',itemCls:'x-menu-check-item x-form-item',groupClass:'x-menu-group-item',inputType:'hidden',inSetChecked:false,inputElement:false,basedOn:false,isFormField:true,onResize:function(){Roo.form.Checkbox.superclass.onResize.apply(this,arguments);if(!this.boxLabel){this.el.alignTo(this.wrap,'c-c');}},initEvents:function(){Roo.form.Checkbox.superclass.initEvents.call(this);this.el.on("click",this.onClick,this);this.el.on("change",this.onClick,this);},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},onRender:function(ct,B){Roo.form.Checkbox.superclass.onRender.call(this,ct,B);this.wrap=this.el.wrap({cls:'x-menu-check-item '});var C=this.wrap.createChild({tag:'img',cls:'x-menu-item-icon',style:'margin: 0px;',src:Roo.BLANK_IMAGE_URL});this.viewEl=C;this.wrap.on('click',this.onClick,this);this.el.on('DOMAttrModified',this.setFromHidden,this);this.el.on('propertychange',this.setFromHidden,this);if(this.boxLabel){this.wrap.createChild({tag:'label',htmlFor:this.el.id,cls:'x-form-cb-label',html:this.boxLabel});}
-this.setChecked(this.checked);},initValue:Roo.emptyFn,getValue:function(){if(this.el){return String(this.el.dom.value)==String(this.inputValue)?this.inputValue:this.valueOff;}return this.valueOff;},onClick:function(){this.setChecked(!this.checked);},setValue:function(v,D){this.setChecked(v===this.inputValue);},setChecked:function(E,F){if(this.inSetChecked){this.checked=E;return;}if(this.wrap){this.wrap[E?'addClass':'removeClass']('x-menu-item-checked');}
+this.setChecked(this.checked);},initValue:Roo.emptyFn,getValue:function(){if(this.el){return String(this.el.dom.value)==String(this.inputValue)?this.inputValue:this.valueOff;}return this.valueOff;},onClick:function(){this.setChecked(!this.checked);},setValue:function(v,D){this.setChecked(String(v)===String(this.inputValue),D);},setChecked:function(E,F){if(this.inSetChecked){this.checked=E;return;}if(this.wrap){this.wrap[E?'addClass':'removeClass']('x-menu-item-checked');}
 this.checked=E;if(F!==true){this.fireEvent('checkchange',this,E);}
 this.inSetChecked=true;this.el.dom.value=E?this.inputValue:this.valueOff;this.inSetChecked=false;},setFromHidden:function(){if(!this.el){return;}
 this.setValue(this.el.dom.value);},onDestroy:function(){if(this.viewEl){Roo.get(this.viewEl).remove();}