function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
prasanth sfdcprasanth sfdc 

wrapper class data is not displaying lightning page

Hi,  i am trying to display wrapper class data in lighning page. But noting is coming. But in cosole.log data is coming. Please help me to findout this thing.   

 
public class accwrapperclass {

    public class accwrapper
    {
      @AuraEnabled  public account acc{set;get;}
      @AuraEnabled  public boolean check{set;get;}
    }
}



public class selectedaccountslight {
 
    
    @auraEnabled
    public static list<accwrapperclass.accwrapper> getalldatas()
    {
        list<accwrapperclass.accwrapper> accWrapperList = new list<accwrapperclass.accwrapper>();
        
        for(account a1:[select id,name,phone,industry from account ])
        {
            accwrapperclass.accwrapper aw1 = new accwrapperclass.accwrapper();
            aw1.check= false;
            aw1.acc = a1;
            accWrapperList.add(aw1);
            
        }
        return accWrapperList;
    }

}








<aura:component controller="selectedaccountslight">
           <aura:handler name="init" value="{!this}" action="{!c.myAction}"/>
   <aura:attribute name="accwrappervalues" type="accwrapperclass.accwrapper[]" /> 

    <aura:iteration items="{!v.accwrappervalues}" var="data">
    {!data.check}....  
    
    
    </aura:iteration>
	
</aura:component>











({
	myAction : function(component, event, helper) {
        
        var action = component.get("c.getalldatas");
 console.log("hello raja");
        
        //Setting the Callback
            action.setCallback(this,function(a){
                //get the response state
                var state = a.getState();
                		  console.log("hello raja2");

                //check if result is successfull
                if(state == "SUCCESS"){
                    
                    var wrapdata = a.getReturnValue();
                    console.log("The wrapdata is: " ,wrapdata);
                  component.get("v.accwrappervalues",wrapdata);
                    
                } 
            });
            
            //adds the server-side action to the queue        
            $A.enqueueAction(action);
		  console.log("hello raja3");
	}
})

 
sfdcMonkey.comsfdcMonkey.com
hi
use
component.set("v.accwrappervalues",wrapdata);
insteadof component.get("v.accwrappervalues",wrapdata);
in your js controller
thanks
Mark it best answer if it helps you so it make proper solution for others :)
 
sfdcMonkey.comsfdcMonkey.com
or let me inform if you have any issue with it :)
Amit Singh 1Amit Singh 1
Hi Prasanth,

Try replacing below you controller.js with the given code.
({
	myAction : function(component, event, helper) {
        
        var action = component.get("c.getalldatas");
 console.log("hello raja");
        
        //Setting the Callback
            action.setCallback(this,function(a){
                //get the response state
                var state = a.getState();
                		  console.log("hello raja2");

                //check if result is successfull
                if(state == "SUCCESS"){
                    
                    var wrapdata = a.getReturnValue();
                    console.log("The wrapdata is: " ,wrapdata);
                  component.set("v.accwrappervalues",wrapdata);
                    
                } 
            });
            
            //adds the server-side action to the queue        
            $A.enqueueAction(action);
		  console.log("hello raja3");
	}
})

Let me know if this helps :)

Thanks,
Amit Singh.