From a6bfce413b4e62ab42b199453dbdd2360bbb16da Mon Sep 17 00:00:00 2001 From: Alan Date: Fri, 23 Sep 2022 11:40:26 +0800 Subject: [PATCH] sync --- Roo/form/Radio.js | 2 +- docs/json/roodata.json | 6 ++-- docs/src/Roo_form_BasicForm.js.html | 8 +++++- docs/src/Roo_form_Checkbox.js.html | 4 ++- docs/src/Roo_form_Radio.js.html | 42 +++++++++++++++++++++++++++- docs/symbols/Roo.form.BasicForm.json | 2 +- docs/symbols/Roo.form.Form.json | 2 +- docs/symbols/Roo.form.Radio.json | 2 +- roojs-all.js | 2 +- roojs-debug.js | 2 +- roojs-ui-debug.js | 2 +- roojs-ui.js | 2 +- 12 files changed, 62 insertions(+), 14 deletions(-) diff --git a/Roo/form/Radio.js b/Roo/form/Radio.js index 0216a4bb93..974e543781 100644 --- a/Roo/form/Radio.js +++ b/Roo/form/Radio.js @@ -77,7 +77,7 @@ Roo.extend(Roo.form.Radio, Roo.form.Checkbox, { //} this.setChecked(String(v) === String(this.inputValue), suppressEvent); - this.el.dom.form[this.name] = v; + this.el.dom.form[this.name].value = v; //this.fireEvent("check", this, this.checked); }, diff --git a/docs/json/roodata.json b/docs/json/roodata.json index 485b3f2ade..1914e1dd02 100644 --- a/docs/json/roodata.json +++ b/docs/json/roodata.json @@ -216152,7 +216152,7 @@ { "name" : "asString", "type" : "Boolean", - "desc" : "(default false)", + "desc" : "(def)", "isOptional" : false } ], @@ -244914,7 +244914,7 @@ { "name" : "asString", "type" : "Boolean", - "desc" : "(default false)", + "desc" : "(def)", "isOptional" : false } ], @@ -259821,7 +259821,7 @@ "desc" : "Sets the checked state of the checkbox.\nOn is always based on a string comparison between inputValue and the param.", "sig" : "(value, suppressEvent)", "static" : false, - "memberOf" : "Roo.form.Checkbox", + "memberOf" : "", "isStatic" : false, "isConstructor" : false, "isPrivate" : false, diff --git a/docs/src/Roo_form_BasicForm.js.html b/docs/src/Roo_form_BasicForm.js.html index e0a4d541ad..3573f10ff8 100644 --- a/docs/src/Roo_form_BasicForm.js.html +++ b/docs/src/Roo_form_BasicForm.js.html @@ -507,6 +507,9 @@ clientValidation Boolean Applies to submit only. Pass true to call fo for(id in values){ if(typeof values[id] != 'function' && (field = this.findField(id))){ + + + if (field.setFromData && field.valueField && field.displayField && @@ -521,6 +524,9 @@ clientValidation Boolean Applies to submit only. Pass true to call fo sd[field.displayField] = typeof(values[field.name]) == 'undefined' ? '' : values[field.name]; field.setFromData(sd); + } else if (field.inputType && field.inputType == 'radio') { + + field.setValue(values[id]); } else { field.setValue(values[id]); } @@ -546,7 +552,7 @@ clientValidation Boolean Applies to submit only. Pass true to call fo /** * Returns the fields in this form as an object with key/value pairs. If multiple fields exist with the same name * they are returned as an array. - * @param {Boolean} asString (default false) + * @param {Boolean} asString (def) * @return {Object} */ getValues : function(asString) diff --git a/docs/src/Roo_form_Checkbox.js.html b/docs/src/Roo_form_Checkbox.js.html index 39096f0cb5..b22a8e7d8f 100644 --- a/docs/src/Roo_form_Checkbox.js.html +++ b/docs/src/Roo_form_Checkbox.js.html @@ -190,7 +190,9 @@ this.fireEvent('check', this, state); } this.inSetChecked = true; - this.el.dom.value = state ? this.inputValue : this.valueOff; + + this.el.dom.value = state ? this.inputValue : this.valueOff; + this.inSetChecked = false; }, diff --git a/docs/src/Roo_form_Radio.js.html b/docs/src/Roo_form_Radio.js.html index 31049d3915..464ced8576 100644 --- a/docs/src/Roo_form_Radio.js.html +++ b/docs/src/Roo_form_Radio.js.html @@ -60,7 +60,47 @@ this.el.dom.checked = 'checked' ; } - } + }, + /** + * Sets the checked state of the checkbox. + * 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(String(v) === String(this.inputValue), suppressEvent); + + this.el.dom.form[this.name] = v; + + //this.fireEvent("check", this, this.checked); + }, + // private.. + setChecked : function(state,suppressEvent) + { + if(this.wrap){ + this.wrap[state ? 'addClass' : 'removeClass']('x-menu-item-checked'); + } + this.checked = state; + if(suppressEvent !== true){ + this.fireEvent('check', this, state); + } + + + + + }, + reset : function(){ + // this.setValue(this.resetValue); + //this.originalValue = this.getValue(); + this.clearInvalid(); + } }); \ No newline at end of file diff --git a/docs/symbols/Roo.form.BasicForm.json b/docs/symbols/Roo.form.BasicForm.json index 32cc83a2ac..abd6d5f199 100644 --- a/docs/symbols/Roo.form.BasicForm.json +++ b/docs/symbols/Roo.form.BasicForm.json @@ -286,7 +286,7 @@ { "name" : "asString", "type" : "Boolean", - "desc" : "(default false)", + "desc" : "(def)", "isOptional" : false } ], diff --git a/docs/symbols/Roo.form.Form.json b/docs/symbols/Roo.form.Form.json index 4b50cc6c54..5d461f7454 100644 --- a/docs/symbols/Roo.form.Form.json +++ b/docs/symbols/Roo.form.Form.json @@ -808,7 +808,7 @@ { "name" : "asString", "type" : "Boolean", - "desc" : "(default false)", + "desc" : "(def)", "isOptional" : false } ], diff --git a/docs/symbols/Roo.form.Radio.json b/docs/symbols/Roo.form.Radio.json index 49fc78890f..d41ae41913 100644 --- a/docs/symbols/Roo.form.Radio.json +++ b/docs/symbols/Roo.form.Radio.json @@ -317,7 +317,7 @@ "desc" : "Sets the checked state of the checkbox.\nOn is always based on a string comparison between inputValue and the param.", "sig" : "(value, suppressEvent)", "static" : false, - "memberOf" : "Roo.form.Checkbox", + "memberOf" : "", "isStatic" : false, "isConstructor" : false, "isPrivate" : false, diff --git a/roojs-all.js b/roojs-all.js index 97958a8815..cac12bf133 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -1852,7 +1852,7 @@ this.el.on('DOMAttrModified',this.setFromHidden,this);this.el.on('propertychange // Roo/form/Radio.js Roo.form.Radio=function(){Roo.form.Radio.superclass.constructor.apply(this,arguments);};Roo.extend(Roo.form.Radio,Roo.form.Checkbox,{inputType:'radio',getGroupValue:function(){return this.el.up('form').child('input[name='+this.el.dom.name+']:checked',true).value; },onRender:function(ct,A){Roo.form.Checkbox.superclass.onRender.call(this,ct,A);if(this.inputValue!==undefined){this.el.dom.value=this.inputValue;}this.wrap=this.el.wrap({cls:"x-form-check-wrap"});if(this.boxLabel){this.wrap.createChild({tag:'label',htmlFor:this.el.id,cls:'x-form-cb-label',html:this.boxLabel} -);}if(this.checked){this.el.dom.checked='checked';}},setValue:function(v,A){this.setChecked(String(v)===String(this.inputValue),A);this.el.dom.form[this.name]=v;},setChecked:function(A,B){if(this.wrap){this.wrap[A?'addClass':'removeClass']('x-menu-item-checked'); +);}if(this.checked){this.el.dom.checked='checked';}},setValue:function(v,A){this.setChecked(String(v)===String(this.inputValue),A);this.el.dom.form[this.name].value=v;},setChecked:function(A,B){if(this.wrap){this.wrap[A?'addClass':'removeClass']('x-menu-item-checked'); }this.checked=A;if(B!==true){this.fireEvent('check',this,A);}},reset:function(){this.clearInvalid();}}); // Roo/rtf/namespace.js Roo.rtf={}; diff --git a/roojs-debug.js b/roojs-debug.js index 1ecbd23def..29bfd4a4ea 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -45135,7 +45135,7 @@ Roo.extend(Roo.form.Radio, Roo.form.Checkbox, { //} this.setChecked(String(v) === String(this.inputValue), suppressEvent); - this.el.dom.form[this.name] = v; + this.el.dom.form[this.name].value = v; //this.fireEvent("check", this, this.checked); }, diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index 5151bc01c1..8299201cb3 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -20636,7 +20636,7 @@ Roo.extend(Roo.form.Radio, Roo.form.Checkbox, { //} this.setChecked(String(v) === String(this.inputValue), suppressEvent); - this.el.dom.form[this.name] = v; + this.el.dom.form[this.name].value = v; //this.fireEvent("check", this, this.checked); }, diff --git a/roojs-ui.js b/roojs-ui.js index f3db22cd19..1fb6fed453 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -905,7 +905,7 @@ this.el.on('DOMAttrModified',this.setFromHidden,this);this.el.on('propertychange // Roo/form/Radio.js Roo.form.Radio=function(){Roo.form.Radio.superclass.constructor.apply(this,arguments);};Roo.extend(Roo.form.Radio,Roo.form.Checkbox,{inputType:'radio',getGroupValue:function(){return this.el.up('form').child('input[name='+this.el.dom.name+']:checked',true).value; },onRender:function(ct,A){Roo.form.Checkbox.superclass.onRender.call(this,ct,A);if(this.inputValue!==undefined){this.el.dom.value=this.inputValue;}this.wrap=this.el.wrap({cls:"x-form-check-wrap"});if(this.boxLabel){this.wrap.createChild({tag:'label',htmlFor:this.el.id,cls:'x-form-cb-label',html:this.boxLabel} -);}if(this.checked){this.el.dom.checked='checked';}},setValue:function(v,A){this.setChecked(String(v)===String(this.inputValue),A);this.el.dom.form[this.name]=v;},setChecked:function(A,B){if(this.wrap){this.wrap[A?'addClass':'removeClass']('x-menu-item-checked'); +);}if(this.checked){this.el.dom.checked='checked';}},setValue:function(v,A){this.setChecked(String(v)===String(this.inputValue),A);this.el.dom.form[this.name].value=v;},setChecked:function(A,B){if(this.wrap){this.wrap[A?'addClass':'removeClass']('x-menu-item-checked'); }this.checked=A;if(B!==true){this.fireEvent('check',this,A);}},reset:function(){this.clearInvalid();}}); // Roo/rtf/namespace.js Roo.rtf={}; -- 2.39.2