Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ReportChartCmpController
({
doInit : function(component, event, helper) {
let action = component.get("c.fetchReportChartSettings");
action.setCallback(this,function(response){
let state = response.getState();
if(state == 'SUCCESS'){
let result = response.getReturnValue();
console.log('Result: ' +result);
if(result.Report_Name__c!=null && result.Report_Name__c!=''){
component.set("v.selectedReport",result.Report_Name__c);
}
if(result.Chart_Type__c!=null && result.Chart_Type__c!=''){
component.set("v.selectedChartType",result.Chart_Type__c);
}
helper.getReports(component,event,helper);
}
else{
if(response.getReturnValue()==null){
helper.getReports(component,event,helper);
}
console.log('Something went wrong! ');
}
});
$A.enqueueAction(action);
},
onSelectReportChange : function(component, event, helper) {
component.set("v.isChartReady",true);
component.set("v.selectedReport",event.getSource().get("v.value"));
helper.CreateChart(component);
helper.updateSettings(component,event,helper);
},
onSelectChartTypeChange : function(component, event, helper) {
component.set("v.isChartReady",true);
component.set("v.selectedChartType",event.getSource().get("v.value"));
helper.CreateChart(component);
helper.updateSettings(component,event,helper);
},
showSpinner: function(component, event, helper) {
// make Spinner attribute true for display loading spinner
component.set("v.Spinner", true);
},
// this function automatic call by aura:doneWaiting event
hideSpinner : function(component,event,helper){
// make Spinner attribute to false for hide loading spinner
component.set("v.Spinner", false);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment