0

Displaying the Set<String> value in lightning-radio-group

"filterlabel": "Age",
"filterValue": ["9-13", "5-8"]

From My Controller, I'm getting filterlabel and filterValue , When i tried to display the filterValue in lightning-radio-group i'm getting empty radio group button as below. (the controller will return an array of object, Each object has a Own filter - Dynamic filter)

enter image description here

<lightning-radio-group 
    name="filter" 
    label={sub.filterlabel}
    options={sub.filterValue} 
    type="button">
</lightning-radio-group>

1 Answer 1

0

Options need to be in the specific format. { label: 'Sales', value: 'option1' }.

so

 "filterValue": [
    "9-13",
    "5-8"
]

should be.

 "filterValue": [
    { "label": "9-13", "value": "9-13" },
    { "label": "5-8", "value": "5-8" }
]

You can create a wrapper class in apex for that.

public class OptionWrapper{
    @auraEnabled
    public string label{get;set;}
    @auraEnabled
    public string value{get;set;}
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .