Threaded View
-
3 Nov 2010 6:29 AM #1
[OPEN-1387] Radiogroup reset clears all values
[OPEN-1387] Radiogroup reset clears all values
Ext version tested:
- Ext 3.2.1
- ext
- only default ext-all.css
- IE8
- IE9
- FF3 (firebug 1.3.0.10 installed)
- Linux Ubuntu 10.10 64
- WinXP Pro
- Resetting a radiogroup causes all radios to be disabled, rather than
reverting back to the original value. As reset is used by form reset this
is rather troublesome.
Code:<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title id='title'>Radiogroup reset</title> <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" /> <script type="text/javascript" src="../../adapter/ext/ext-base.js"></script> <script type="text/javascript" src="../../ext-all-debug.js"></script> The radiogroup below has default value choice2.<br> When we reset the radiogroup, all fields are cleared rather than being reset to the originalValue.<br> This is especially troublesome as reset is used by BasicForm.reset.<br><br> <div id="content"></div> <script type="text/javascript"> Ext.onReady(function(){ new Ext.FormPanel({ renderTo: 'content', items: [{ "id":"rg", "name":"rg", "xtype":"radiogroup", "value":"Choice 2", "items":[ {"inputValue":"Choice 1","boxLabel":"choice1","name":"rg"}, {"inputValue":"Choice 2","boxLabel":"choice2","name":"rg"} ]}, { xtype: 'button', text: 'reset', handler: function () { Ext.getCmp("rg").reset() }, scope: this }] }); }); //end onReady </script> </head> <body> </body> </html>
Steps to reproduce the problem:
- Create a radiogroup
- set a default value
- Call reset
- The radiogroup should select the default value on reset
- All selections are cleared making for a very sily radiogroup
- It seems the checkboxgroup reset function supports two methods to set the default value:
- If orginalValue is set, use it
- but, originalValue is never set (normally this happens in the initValue function, but checkbocgroup has overriden this function and it does not call super and does not set the originalValue.
- when no originalValue is set, the reset function will ask the individual radiobuttons to reset themselves to their defaultvalue
- but radiogroup/checkboxgroup set the indivial radio values after the originalValue was stored, so the radios are always empty.
Code:// on radiogroup.reset all checkboxes are cleared Ext.form.RadioGroup.override({ initValue : function(){ if(this.value){ this.originalValue=this.value[0]; this.setValue.apply(this, this.buffered ? this.value : [this.value]); delete this.buffered; delete this.value; } } });Last edited by kvr; 9 Nov 2010 at 4:43 AM. Reason: Hoping to get a definite fix...
Thank you for reporting this bug. We will make it our priority to review this report.
Similar Threads
-
BasicForm.reset: Resets to default values?
By darthwes in forum Ext 3.x: Help & DiscussionReplies: 19Last Post: 1 Nov 2010, 11:29 AM -
[2.2][CLOSED] BasicForm.updateRecord updates clears values
By igo in forum Ext 2.x: BugsReplies: 2Last Post: 3 Oct 2008, 5:48 AM -
Reset button to clear form values?
By onmission in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 17 Nov 2007, 11:34 AM


Reply With Quote