1

I'm attempting to generate a lightning:radioGroup selection inside my data table, I have a object returning a List<String> but it isn't giving me the styling, it's spitting out the data correct.

<aura:iteration items="{!v.column.selectOptionRow}" var="option" indexVar="idx"> <lightning:radioGroup aura:id="radioGrp- + idx" name="radioButtonGroup" label="{!option.radioLabel}" options="{!option.radioValue}" value="{!v.radioGrpValue}" onchange="{! c.handleRadioGroupChange}"/> </aura:iteration> 

And it appears like this

enter image description here

Am I going about this wrong

1 Answer 1

4

lightning:radioGroup is a self-contained element that expects an attribute named "options" to be set. What you're doing is basically showing a bunch of "empty" radio groups.

If you want to use an iteration, specify lightning:input type="radio" name="radioGroup". Each radio group item must have the same name. Note that aura:id cannot be dynamically rendered, so don't bother trying.

<aura:iteration items="{!v.column.selectOptionRow}" var="option" indexVar="idx"> <lightning:input aura:id="assignmentOptions" name="radioButtonGroup" label="{!option.radioLabel}" type="radio" options="{!option.radioValue}" value="{!v.radioGrpValue}" onchange="{! c.handleRadioGroupChange}"/> </aura:iteration> 

If you want to use lightning:radioGroup, then simply specify the options in an attribute:

<lightning:radioGroup aura:id="assignmentOptions" name="radioButtonGroup" options="{!v.column.selectOptionRow}" value="{!v.radioGrpValue}" onchange="{! c.handleRadioGroupChange}"/> 

(Note: I haven't carefully checked all the attributes, some additional tweaking may be needed. Please check the documentation.)

2
  • Thanks, there is also some binding that I wasn't aware was so strict.. my properties had to be named label and value, I swore I tried your resolution before I must of been burned out end of day.. Commented Feb 28, 2018 at 5:41
  • Also to add to this, I didn't realize it took a type which is button as an attribute Commented Feb 28, 2018 at 6:46

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.