hi guys i have a doubt ,on click of a button in a lightining component a pop up screen should populate the some information realted to the another object related to the object present in the component .. pls any explain how to do it
({
showModal : function(component, event, helper) {
var action = component.get('c.fetchAccount');
action.setCallback(this, function(response) {
//store state of response
var state = response.getState();
if (state === "SUCCESS") {
//set response value in ListOfAccount attribute on component.
component.set('v.AccountList', response.getReturnValue());
}
});
$A.enqueueAction(action);
document.getElementById("newClientSectionId").style.display = "block";
},
hideModal : function(component,event, helper){
document.getElementById("newClientSectionId").style.display = "none" ;
}
})
Apex Class Controller:
public class accWithContController {
@AuraEnabled
public static list < Account > fetchAccount() {
// query 10 records from account with their relevant contacts and return query.
List < Account > lstOfAcc = [select Name, AnnualRevenue, BillingState, (select LastName from contacts) from Account LIMIT 10];
return lstOfAcc;
}
}
({
showModal : function(component, event, helper) {
var action = component.get('c.fetchAccount');
action.setCallback(this, function(response) {
//store state of response
var state = response.getState();
if (state === "SUCCESS") {
//set response value in ListOfAccount attribute on component.
component.set('v.AccountList', response.getReturnValue());
}
});
$A.enqueueAction(action);
document.getElementById("newClientSectionId").style.display = "block";
},
hideModal : function(component,event, helper){
document.getElementById("newClientSectionId").style.display = "none" ;
}
})
Apex Class Controller:
public class accWithContController {
@AuraEnabled
public static list < Account > fetchAccount() {
// query 10 records from account with their relevant contacts and return query.
List < Account > lstOfAcc = [select Name, AnnualRevenue, BillingState, (select LastName from contacts) from Account LIMIT 10];
return lstOfAcc;
}
}
Component Client Controller Apex Class Controller:
Applicaiton To Test:
If this helps out, please choose this as best answer.
Thank you!
All Answers
Component Client Controller Apex Class Controller:
Applicaiton To Test:
If this helps out, please choose this as best answer.
Thank you!