You need to sign in to do that
Don't have an account?
Radhika Pawar 12
after save records button shows clicked+lightning component and toast msg also not fir
**My component:**
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="sampleFundController">
<!-- init aura:handler action[doInit] auto call on component load -->
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<!-- 1."ChildRecordList" attibute store the list of child record. -->
<aura:attribute name="ChildRecordList" type="List" />
<!--Use a data table from the Lightning Design System:
https://www.lightningdesignsystem.com/components/data-tables/ -->
<aura:attribute name="ShowHidecancle" type="boolean" default="false"/>
<aura:attribute name="ShowHideSave" type="boolean" default="false"/>
<aura:handler event="force:refreshView" action="{!c.isRefreshed}" />
<lightning:notificationsLibrary aura:id="notifLib"/>
<div class="slds-m-around--x-small">
<table class="slds-table slds-table--bordered slds-table--striped slds-table--cell-buffer slds-table--fixed-layout">
<thead>
<tr class="slds-text-heading--label">
<th scope="col">
<div class="slds-truncate" title="Name">Name</div>
</th>
<th scope="col">
<div class="slds-truncate" title="Email">Email</div>
</th>
</tr>
</thead>
<tbody>
<!-- Iterate all child record list in table format -->
<aura:iteration items="{!v.ChildRecordList}" var="rec">
<tr>
<td>
<div class="slds-truncate" title="{!rec.Name}">{!rec.Name}</div>
</td>
<td>
<div class="slds-truncate" title="{!rec.Publication_2__c}">
<lightning:input type="checkbox" variant="label-hidden" checked="{!rec.Publication_1__c}" aura:id="AC_GFI"/>
</div>
</td>
</tr>
</aura:iteration>
</tbody>
</table>
<div class="slds-col modal-footer slds-modal__footer">
<center>
<button class="slds-button slds-button--neutral uiButton--default uiButton--default uiButton" type="button">
<lightning:button variant="neutral" label="Cancel" onclick="{! c.handleCancel }" />
</button>
<button class="slds-button slds-button--neutral uiButton--default uiButton--brand uiButton" type="button">
<lightning:button variant="brand" label="Save" onclick="{!c.handleSave}" />
</button>
</center>
</div>
</div>
</aura:component>
**JScontroller:**
({
doInit : function(component, event, helper) {
helper.getfunds(component, helper);
},
handleSave : function(component, event, helper) {
helper.saveHandler(component, event, helper);
},
handleCancel: function(component, event, helper) {
//$A.get("e.force:closeQuickAction").fire();
helper.getfunds(component, helper);
},
})
**JsHelper:**
({
getfunds : function(component, event, helper) {
var action = component.get("c.getfunds");
console.log("action**"+action);
var editedRecords = component.get("v.recordId");
console.log("editedRecords**"+editedRecords);
action.setParams({
'fundId' : editedRecords
});
action.setCallback(this,function(response) {
var state = response.getState();
console.log("state**"+state);
if (state === "SUCCESS") {
console.log("length*RAD**"+response.getReturnValue().length);
console.log("state**"+response.getReturnValue());
component.set("v.ChildRecordList", response.getReturnValue());
$A.get('e.force:refreshView').fire();
}
});
$A.enqueueAction(action);
},
saveHandler : function(component, event, helper) {
alert("Record Already exists.");
//component.set("v.showSpinner", true);
var action = component.get("c.updateFunds");
console.log("action**"+action);
var editedRecords = component.get("v.ChildRecordList");
console.log("editedRecords**"+editedRecords);
action.setParams({
'editedfundList' : editedRecords
});
action.setCallback(this,function(response) {
var state = response.getState();
console.log("state**"+state);
var result = response.getReturnValue();
console.log("result**"+result);
if (state === "SUCCESS") {
console.log("length*RAD**"+response.getReturnValue().length);
console.log("response**"+response.getReturnValue());
component.set("v.ShowHideSave", true);
var showToast = $A.get("e.force:showToast");
showToast.setParams({
'title' : 'Success!',
'type': 'success',
'message' : "The record has been updated successfully."
});
showToast.fire();
$A.get('e.force:refreshView').fire();
}else{
console.log("Error**");
}
});
$A.enqueueAction(action);
},
})
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="sampleFundController">
<!-- init aura:handler action[doInit] auto call on component load -->
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<!-- 1."ChildRecordList" attibute store the list of child record. -->
<aura:attribute name="ChildRecordList" type="List" />
<!--Use a data table from the Lightning Design System:
https://www.lightningdesignsystem.com/components/data-tables/ -->
<aura:attribute name="ShowHidecancle" type="boolean" default="false"/>
<aura:attribute name="ShowHideSave" type="boolean" default="false"/>
<aura:handler event="force:refreshView" action="{!c.isRefreshed}" />
<lightning:notificationsLibrary aura:id="notifLib"/>
<div class="slds-m-around--x-small">
<table class="slds-table slds-table--bordered slds-table--striped slds-table--cell-buffer slds-table--fixed-layout">
<thead>
<tr class="slds-text-heading--label">
<th scope="col">
<div class="slds-truncate" title="Name">Name</div>
</th>
<th scope="col">
<div class="slds-truncate" title="Email">Email</div>
</th>
</tr>
</thead>
<tbody>
<!-- Iterate all child record list in table format -->
<aura:iteration items="{!v.ChildRecordList}" var="rec">
<tr>
<td>
<div class="slds-truncate" title="{!rec.Name}">{!rec.Name}</div>
</td>
<td>
<div class="slds-truncate" title="{!rec.Publication_2__c}">
<lightning:input type="checkbox" variant="label-hidden" checked="{!rec.Publication_1__c}" aura:id="AC_GFI"/>
</div>
</td>
</tr>
</aura:iteration>
</tbody>
</table>
<div class="slds-col modal-footer slds-modal__footer">
<center>
<button class="slds-button slds-button--neutral uiButton--default uiButton--default uiButton" type="button">
<lightning:button variant="neutral" label="Cancel" onclick="{! c.handleCancel }" />
</button>
<button class="slds-button slds-button--neutral uiButton--default uiButton--brand uiButton" type="button">
<lightning:button variant="brand" label="Save" onclick="{!c.handleSave}" />
</button>
</center>
</div>
</div>
</aura:component>
**JScontroller:**
({
doInit : function(component, event, helper) {
helper.getfunds(component, helper);
},
handleSave : function(component, event, helper) {
helper.saveHandler(component, event, helper);
},
handleCancel: function(component, event, helper) {
//$A.get("e.force:closeQuickAction").fire();
helper.getfunds(component, helper);
},
})
**JsHelper:**
({
getfunds : function(component, event, helper) {
var action = component.get("c.getfunds");
console.log("action**"+action);
var editedRecords = component.get("v.recordId");
console.log("editedRecords**"+editedRecords);
action.setParams({
'fundId' : editedRecords
});
action.setCallback(this,function(response) {
var state = response.getState();
console.log("state**"+state);
if (state === "SUCCESS") {
console.log("length*RAD**"+response.getReturnValue().length);
console.log("state**"+response.getReturnValue());
component.set("v.ChildRecordList", response.getReturnValue());
$A.get('e.force:refreshView').fire();
}
});
$A.enqueueAction(action);
},
saveHandler : function(component, event, helper) {
alert("Record Already exists.");
//component.set("v.showSpinner", true);
var action = component.get("c.updateFunds");
console.log("action**"+action);
var editedRecords = component.get("v.ChildRecordList");
console.log("editedRecords**"+editedRecords);
action.setParams({
'editedfundList' : editedRecords
});
action.setCallback(this,function(response) {
var state = response.getState();
console.log("state**"+state);
var result = response.getReturnValue();
console.log("result**"+result);
if (state === "SUCCESS") {
console.log("length*RAD**"+response.getReturnValue().length);
console.log("response**"+response.getReturnValue());
component.set("v.ShowHideSave", true);
var showToast = $A.get("e.force:showToast");
showToast.setParams({
'title' : 'Success!',
'type': 'success',
'message' : "The record has been updated successfully."
});
showToast.fire();
$A.get('e.force:refreshView').fire();
}else{
console.log("Error**");
}
});
$A.enqueueAction(action);
},
})