-
Bug
-
Resolution: Fixed
-
Normal
-
8.5.0
-
None
-
Security Level: Jimmy
-
None
Steps to Reproduce
Run fiddle
http://zkfiddle.org/sample/1u8kl6h/2-RadioGroup-index-not-updated-if-radio-is-in-subcomponents
Click the add button 3 times to add 3 radio buttons.
Select the 3rd radio.
Click delete to remove a radio
Select another radio button
Current Result
Exception
java.lang.IndexOutOfBoundsException: 2 out of 0..1
at org.zkoss.zul.Radiogroup.getItemAtIndex(Radiogroup.java:140)
at org.zkoss.zul.Radiogroup.getSelectedItem(Radiogroup.java:215)
at org.zkoss.zul.Radio.fixSiblings(Radio.java:174)
at org.zkoss.zul.Radio.service(Radio.java:258)
Expected Result
No exception
Debug Info
Only happen if the radio are descendant, but not direct children of the radiogroup
case 2 (direct children) doesn't show the issue
Root Cause
_jsel is not updated when removing a descendant radio
possible additional safety after fix: check if _jsel < radiogroup.getItemCount() in getSelectedItem()
Workaround
attached RadioGroup override class for ZK 8.5.0
- blocks
-
ZK-4763 Radiogroup selectedIndex error after radio moved
- Closed