adriantan08
Giga Expert
Options
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 10-24-2018 01:56 AM
Setting values of a sn-choice-list is different from sn-record-picker where we pass to the field an array of a single object together with its displayValue and value - something like c.recordPicker = [{"displayValue": "test", "value": "testValue"}].
In sn-choice-list, it's more straightforward. You just have to assign the field a value itself from its existing options.
HTML
<sn-choice-list
field="c.mychoice"
sn-model="c.mychoice"
sn-options="c.mychoicelistoption"
sn-value-field="myChoiceValue"
sn-text-field="myChoiceDisplay"
sn-items="c.mychoiceoptions">
</sn-choice-list>
Client Script
c.mychoiceoptions = [{
myChoiceDisplay:"Choice 1",
myChoiceValue:'choice1'
},
{
myChoiceDisplay:"Choice 2",
myChoiceValue:'choice2'
}];
c.mychoicelistoption = {
hideSearch: true
};
c.mychoice = "choice1";
As seen, you simply have to assign a valid value within c.mychoiceoptions based on your mapped field in sn-value-field which in this case should be taken from c.mychoiceoptions.myChoiceValue.
Labels:
- 9,460 Views