-3

Hi how to show data in aura:iteration in the below format, attribute is of type strings[].

a b
c d
e f
g ..
5
  • can you please post your code
    – Annappa PH
    Commented Dec 11, 2017 at 12:47
  • @AnnappaPH: i need to show in the given format. <aura:iteration items="{!v.test}" var="testing"> {!testing} </aura:iteration>
    – Salesforce
    Commented Dec 11, 2017 at 12:49
  • 1
    Then add values to the list like this <aura:attribute name="test" type="String[]" default="['a b', 'c d', 'e f', 'g ..']" /> and this is just an example do the same in the JS where you are adding values in this List instead of adding a single value on a index add two values. Commented Dec 11, 2017 at 13:17
  • @itzmukeshy7: a is one data, b is one data and c and so on. I want to display in above format, its an example which i have shown. U got the question in wrong sense.
    – Salesforce
    Commented Dec 11, 2017 at 13:20
  • Maybe you are right. So how you are putting data in the list. Commented Dec 11, 2017 at 14:24

1 Answer 1

2

Use the slds grid system to do this. Firstly study about Grid in Lightning Design System.

or

you can also achive this using refer Lightning:layout

Sample Code

<aura:application extends="force:slds">
    <div class="slds-grid slds-wrap">
        <aura:iteration items="['a','b','c','d','e','f']" var="test">
            <span class="slds-size_1-of-2">{!test}</span>
        </aura:iteration>
    </div>
    <lightning:layout multipleRows="true">
        <aura:iteration items="['a','b','c','d','e','f']" var="test">
            <lightning:layoutItem padding="around-large" size="6" smallDeviceSize="12" mediumDeviceSize="6">
           {!test}
            </lightning:layoutItem>
        </aura:iteration>
    </lightning:layout  >
</aura:application>

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