[SalesForce] How to use design:attributes with aura:attribute of type string[]

I have an aura:attribute of type string[] and I want that user should be able to populate the values in that string array through app builder. For this I am using design:attributes as;

Component:

<aura:attribute name="columnHeaders" type="String[]" access="global" description='column Headers' default="['name','Category','Price']"/>
.
.
.
<aura:iteration items="{!v.columnHeaders}" var="colHead">
<!-- some code -->
</aura:iteartion>

Design attribute:

<design:component label="Column Header">
    <design:attribute name="columnHeaders" Label="Column Header" description='column Headers' datasource="Name,Category,Price,Type,Location"/>
</design:component>

But the design attribute don't work with attribute of type String[].

Error: Failed to save undefined: Only String attributes may have a datasource in the design file.: Source

So when I make the attribute of type "String" instead of "String[]" and save in the app builder, it is showing me picklist of values as mentioned but it iterates over single picklist value string (like 'Location') to give me column headers as:

L O C A T I O N S

instead of:

Name Type Category Location

and so on.

Best Answer

Sorry this is currently not supported. Only String, Integer and Boolean is supported, where Strings can have a datasource that will present as a picklist. Reference: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_config_for_app_builder_design_files.htm

Related Topic