Posts

Showing posts from July, 2018

SLDS Table--Insert And Delete Rows Dynamically

Image
In this post, we are going to create a lightning component to insert and delete rows dynamically on slds   datatable . If we hit an INSERT button a new row will be added at the end of the slds table. If we hit a DELETE button the last row will be deleted from the slds datatable automatically. Child Lightning Component1 Component:- <aura:component > <aura:attribute name=”rowIndex” type=”String” default=”1″/> <!– Register 2 Lightning Event for handle add or Delete rows on Parent Component –> <aura:registerEvent name=”DeleteRowEvt” type=”c:DeleteRowEvt”/> <aura:registerEvent name=”AddRowEvt” type=”c:AddNewRowEvt”/> <lightning:button name=”details” label=”ADD” onclick=”{!c.AddNewRow}” /> <lightning:button name=”details” label=”DELETE” onclick=”{!c.removeRow}” /> <table class=”slds-table slds-table_bordered slds-table_cell-buffer”> <thead> <tr class=”slds-text-title_caps”> <th scope=”col”> Name </th>