RADIOGROUP items built dynamically

Started by Benjamin F., December 17, 2015, 10:00:22 PM

Previous topic - Next topic

Benjamin F.

I'm trying to change specific items on a RADIOGROUP to be hidden or shown dynamically. I already have the data I need to determine whether they should be shown, but I don't know how to actually show it.

For example if I start with this:

RADIOGROUP rad_type = formonly.rad_type, ITEMS=((1,"1stChoice"),(2,"2ndChoice"), (3,"3rdChoice")), ORIENTATION=HORIZONTAL;

How can I hide 2ndChoice (for example)? I have fooled around with ui.Dialog.setActionHidden and ui.Form.setElementHidden but haven't been able to make the magic happen. Any advice is greatly appreciated. I'm using Genero Mobile 1.1 if that makes a difference.

Bernard M.

Hi Benjamin,

This is actually not possible, RadioGroup items don't have the hidden attribute at all. Also modifying dynamically the RadioGroup list of items could lead into rendering/layout issues.

You could use a ComboBox instead. And using the ui.ComboBox class you can then add or remove items dynamically with the addItem()/removeItem() methods.

Regards,
Bernard

Nuno G.

Hope this small snipper helps.
Good luck

Nuno G.

Hope this small snippet helps

Benjamin F.

Nuno G, that is extremely helpful. I bet there's a lot of stuff that could be customized that way that otherwise can't be. Thank you so much!!

Nuno G.