Skip to content

Instantly share code, notes, and snippets.

@sujeshramachandran
Created June 26, 2017 12:40
Show Gist options
  • Save sujeshramachandran/a042bd1e42d077c82f38a1d037cfec39 to your computer and use it in GitHub Desktop.
Save sujeshramachandran/a042bd1e42d077c82f38a1d037cfec39 to your computer and use it in GitHub Desktop.
Demo Update/Delete in DataTable - Child
<aura:component controller="Demo_CRUD_CompCtrl">
<aura:attribute access="PUBLIC" name="view" type="Object"/>
<tr>
<th scope="row" data-label="Account Name">
<div class="slds-truncate" ><a href="javascript:void(0);">{!v.view.Name}</a></div>
</th>
<td data-label="Industry">
<div class="slds-truncate" >{!v.view.Industry}</div>
</td>
<td data-label="Close Date">
<div class="slds-truncate" >{!v.view.Phone}</div>
</td>
<td data-label="">
<div class="slds-truncate" >
<button onclick="{!c.callUpdateRecord}" class="slds-button slds-button_icon" title="Edit Record">
<lightning:icon iconName="action:edit" size="xx-small" alternativeText="Edit"/>
<span class="slds-assistive-text">Edit</span>
</button>
<button onclick="{!c.callDeleteRecord}" class="slds-button slds-button_icon" title="Delete Record">
<lightning:icon iconName="action:delete" size="xx-small" alternativeText="Delete"/>
<span class="slds-assistive-text">Delete</span>
</button>
</div>
</td>
</tr>
</aura:component>
({
callDeleteRecord : function(component, event, helper) {
var currentRecordId = component.get("v.view.Id");
alert ('Current Record Id ' + currentRecordId + '. Now you could pass the current record Id to server to delete the record.' )
},
callUpdateRecord : function(component, event, helper) {
var currentRecordId = component.get("v.view.Id");
var currentRecord = component.get("v.view");
alert ('Current Record Id ' + currentRecordId + ' and Current Record Object is ' + component.get('v.view') +'. Now you could pass the current object to a modal popup and show the fields accordingly to update the record.' )
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment