You need to sign in to do that
Don't have an account?
shalini sharma 24
aura://ComponentController: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
Hi,
I am Getting the below error
COMPONENT:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" controller="componentController">
<aura:attribute name="stage" type="String" />
<aura:attribute name="recordId" type="String" />
<aura:attribute name="moretabs" type="Aura.Component[]"/>
<!--aura:attribute name="moretabs" type="String"/-->
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<ui:outputText value="{!v.stage}" />
<lightning:tabset variant="scoped">
{!v.moretabs}
</lightning:tabset>
</aura:component>
CONTROLLER:
({
doInit: function(component, event, helper)
{
var cmpId = component.get("v.recordId");
var stage = component.get("v.stage");
var actiondisplay = component.get("c.fetchStage");
actiondisplay.setParams({
"ComponentId": cmpId,
});
actiondisplay.setCallback(this,function(response)
{
var state=response.getState();
var result=response.getReturnValue();
if(state === "SUCCESS"){
component.set("v.stage",response.getReturnValue());
var stage = component.get("v.stage");
if(stage == "Concept"){
$A.createComponent("lightning:tab", {
"label": "Revision1" ,
"id": "new",
"onactive": component.getReference("c.addContent")
}, function (newTab, status, error) {
if (status === "SUCCESS") {
var body = component.get("v.moretabs[0]");
component.set("v.moretabs[0]", newTab);
var nT = component.get("v.moretabs[0]")
} else {
throw new Error(error);
}
});
},
addContent : function(component, event) {
var tab = event.getSource();
var cmpId = component.get("v.recordId");
switch (tab.get('v.id')){
case 'new':
$A.createComponent("sharinpix:SharinPix", {
"aura:id" : "sharinpix-cmp",
"AlbumId" : cmpId,
"height" : "500"
}, function (newContent, status, error) {
if (status === "SUCCESS") {
tab.set('v.body', newContent);
} else {
throw new Error(error);
}
});
break;
}
}
})
I am Getting the below error
COMPONENT:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" controller="componentController">
<aura:attribute name="stage" type="String" />
<aura:attribute name="recordId" type="String" />
<aura:attribute name="moretabs" type="Aura.Component[]"/>
<!--aura:attribute name="moretabs" type="String"/-->
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<ui:outputText value="{!v.stage}" />
<lightning:tabset variant="scoped">
{!v.moretabs}
</lightning:tabset>
</aura:component>
CONTROLLER:
({
doInit: function(component, event, helper)
{
var cmpId = component.get("v.recordId");
var stage = component.get("v.stage");
var actiondisplay = component.get("c.fetchStage");
actiondisplay.setParams({
"ComponentId": cmpId,
});
actiondisplay.setCallback(this,function(response)
{
var state=response.getState();
var result=response.getReturnValue();
if(state === "SUCCESS"){
component.set("v.stage",response.getReturnValue());
var stage = component.get("v.stage");
if(stage == "Concept"){
$A.createComponent("lightning:tab", {
"label": "Revision1" ,
"id": "new",
"onactive": component.getReference("c.addContent")
}, function (newTab, status, error) {
if (status === "SUCCESS") {
var body = component.get("v.moretabs[0]");
component.set("v.moretabs[0]", newTab);
var nT = component.get("v.moretabs[0]")
} else {
throw new Error(error);
}
});
},
addContent : function(component, event) {
var tab = event.getSource();
var cmpId = component.get("v.recordId");
switch (tab.get('v.id')){
case 'new':
$A.createComponent("sharinpix:SharinPix", {
"aura:id" : "sharinpix-cmp",
"AlbumId" : cmpId,
"height" : "500"
}, function (newContent, status, error) {
if (status === "SUCCESS") {
tab.set('v.body', newContent);
} else {
throw new Error(error);
}
});
break;
}
}
})
can you share your apex controller?
Below is my apex controller:
public class componentController {
@AuraEnabled
public static string fetchStage(string ComponentId)
{
Component__c cmpStage;
string stage;
cmpStage =[select Id,Stage__c from Component__c where Id =:ComponentId ];
stage = cmpStage.stage__c;
return stage;
}
}
I'm facing the same error for this situation, please, let me know if you solved it? Thank you!
Hi everyone!
I'm also facing the same error in this situation, please, let me know if you solved it. Thank you!