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

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.)

| improve this answer | |
  • 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.. – EricSSH Feb 28 '18 at 5:41
  • Also to add to this, I didn't realize it took a type which is button as an attribute – EricSSH Feb 28 '18 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.