Created
June 26, 2017 12:40
-
-
Save sujeshramachandran/a042bd1e42d077c82f38a1d037cfec39 to your computer and use it in GitHub Desktop.
Demo Update/Delete in DataTable - Child
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
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