You need to sign in to do that
Don't have an account?
Andrew Aldis 15
Lightning Controller cannot find my method
I have a ightning component that needs to get a string from a class, but everytime open it I get a error "Uncaught Unknown controller action 'getTableauUrl'Callback failed: aura://ComponentController/ACTION$getComponent" Why can't it find the method.
Compoenent
<aura:component controller="TableauSalesAnalysisLightningController" implements="force:appHostable" >
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:attribute name="tableauUrl" type="string" />
<div style="overflow:hidden; padding:4px; border: solid #ddd 2px; border-radius:4px;" >
<iframe id="reportFrame" src="{!tableauUrl}" height="600PX" width="100%" scrolling="no" frameborder="0" style="position:relative;"/>
</div>
</aura:component>
Controller:
({
doInit : function(component, event, helper) {
console.log('doInit called ');
var action = component.get('c.getTableauUrl');
console.log('action called '+action);
}
})
Class (I removed the logic for security)
public with sharing class TableauSalesAnalysisLightningController {
public String tableauUrl;
private User user;
private Profile profile;
private UserRole role;
public String divisionId;
public String regionId;
public String userName;
public String channel;
public String allParam;
public String dcio;
// Load the tableau username into a static at page load since this won't change
@AuraEnabled
public string getTableauUrl() {
return tableauUrl;
}
}
Compoenent
<aura:component controller="TableauSalesAnalysisLightningController" implements="force:appHostable" >
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:attribute name="tableauUrl" type="string" />
<div style="overflow:hidden; padding:4px; border: solid #ddd 2px; border-radius:4px;" >
<iframe id="reportFrame" src="{!tableauUrl}" height="600PX" width="100%" scrolling="no" frameborder="0" style="position:relative;"/>
</div>
</aura:component>
Controller:
({
doInit : function(component, event, helper) {
console.log('doInit called ');
var action = component.get('c.getTableauUrl');
console.log('action called '+action);
}
})
Class (I removed the logic for security)
public with sharing class TableauSalesAnalysisLightningController {
public String tableauUrl;
private User user;
private Profile profile;
private UserRole role;
public String divisionId;
public String regionId;
public String userName;
public String channel;
public String allParam;
public String dcio;
// Load the tableau username into a static at page load since this won't change
@AuraEnabled
public string getTableauUrl() {
return tableauUrl;
}
}
All Answers