RadioButtonGroup fires select event multiple times when changing selected index
I have a radiobuttongroup with three buttons. I want them all enabled and selectable. But, depending on certain parameters when the user chooses a radio button I may programmatically decide that radio button should not be chosen. In this case I would set the radio button back to the original using RadioButtonGroup.setSelectedIndex() But, this fires the select event multiple times. As an example see this jsbin http://jsbin.com/gayami/edit?html,output Selecting any radio button make the program set the selection back to index 0. But doing this fires the select event 3 times as shown in the console. The select event should fire one time - when the user selects the radio button.
Hi, thanks for pointing this out to us, we'll provide a fix asap. Kind regards, Christiane
tracked internally: 1580057911
Hi,
normally when you don't want a user to select a radio button you should disable it. However, your point is valid (the event should fire once). We will provide a fix with the next patches of the latest release versions (including 1.30 which you are using).
Regards, Marin
I was debugging this and was also trying to see if I could fix this. I looked at the code to understand it. This is what I observed.
- This doesn't happen when using breakpoints.
- I looked at the call stack and it seems to be coming from afterFocus.
- Makes me think that it might be related to focus (afterFocus internally calls setSelectedIndex).
- I will debug further to get some more clues and may be a fix.
Meanwhile, one can try if delaying the default index selection using setTimeout helps.
Fixed.
Thanks and Kind Regards, Diana, SAPUI5 Dispatcher