An abstract class, used to display the values of a picklist in a Lightning component on a Lightning page.
Namespace
Usage
To use this class as the datasource of a picklist in a Lightning component, it must be
extended by a custom Apex class and then that class must be called in the component’s design
file.
Example
Here’s an example of a custom Apex class extending the VisualEditor.DynamicPickList class.
global with sharing class MyCustomPickList extends VisualEditor.DynamicPickList{ global override VisualEditor.DataRow getDefaultValue(){ VisualEditor.DataRow defaultValue = new VisualEditor.DataRow('red', 'RED'); return defaultValue; } global override VisualEditor.DynamicPickListRows getValues() { VisualEditor.DataRow value1 = new VisualEditor.DataRow('red', 'RED'); VisualEditor.DataRow value2 = new VisualEditor.DataRow('yellow', 'YELLOW'); VisualEditor.DynamicPickListRows myValues = new VisualEditor.DynamicPickListRows(); myValues.addRow(value1); myValues.addRow(value2); return myValues; } }
DynamicPickList Methods
The following are methods for DynamicPickList.
getDefaultValue()
Signature
public VisualEditor.DataRow getDefaultValue()
Return Value
Type: VisualEditor.DataRow
getLabel(attributeValue)
Signature
public String getLabel(Object attributeValue)
Parameters
- attributeValue: Type: Object The value of the picklist item.
Return Value
Type: String
isValid(attributeValue)
Returns the valid state of the picklist item’s value. A picklist
value is considered valid if it’s a part of any VisualEditor.DataRow in the VisualEditor.DynamicPickListRows returned by getValues().
Signature
public Boolean isValid(Object attributeValue)
Parameters
- attributeValue: Type: Object The value of the picklist item.
Return Value
Type: Boolean