You need to sign in to do that
Don't have an account?
Rohith Kumar 98
How to have different instance for each row in table row populated with aura:iteration?
I have a button named "Add Line Item" clicking on will create a new row in the table.
When I add one row and change the value in the second column (PRODUCT NAME).
After selecting the value and adding one more row, the values of the first row are copied to the second row also, when I change the value(lightning:select) in any row, It changes in all other rows.
What is causing this and how can I solve the problem, I need different instances for each row.
Body of table component:
When I add one row and change the value in the second column (PRODUCT NAME).
After selecting the value and adding one more row, the values of the first row are copied to the second row also, when I change the value(lightning:select) in any row, It changes in all other rows.
What is causing this and how can I solve the problem, I need different instances for each row.
Body of table component:
<tbody> <aura:iteration items="{!v.rowCount}" indexVar="count" > <tr> <td>{!count + 1}</td> <td><lightning:select variant="label-hidden" class="label-hidden" value="{!v.selectedItem}" onchange="{!c.getValue}"> <option>--None--</option> <aura:iteration items="{!v.relatedItems}" var="item"> <option selected="{!item.selected}" value="{!item.UnitPrice__c}">{!item.Name}</option> </aura:iteration> </lightning:select></td> <td><lightning:input disabled="true" value="{!v.itemUnitPrice}" variant="label-hidden"/></td> <td><lightning:input type="number" variant="label-hidden" autocomplete="off"/><!--Quantity here--></td> <td>Price here</td> <td>Delete Icon Here</td> </tr> </aura:iteration> </tbody>