Skip to main content
2 of 2
deleted 64 characters in body

Using wrapper Class in Lightning:Datatable

I am trying to set the data of the Lightning:Datatable from the wrapper class in server-side Controller.

    public class AccountWrapper{       
        @AuraEnabled public Account acct {get;set;}
        @AuraEnabled public boolean isSelected {get;set;}        
        @AuraEnabled public String errorMsg {get;set;}
        
        public AccountWrapper (Account acc, boolean b, String msg){
            acct = acc;  
            isSelected = b; 
            errorMsg = msg;
        }  
    }

When I am setting the value of the attribute

<aura:attribute name="data" type="List"/>

as :- component.set("v.data", response.getReturnValue().lstAcctWrapper);

But the problem is how we can distinguish the value in the column as rows coming blank.

<lightning:datatable
    keyField="id"
    data="{! v.data }"
    columns="{! v.columns }"
    hideCheckboxColumn="false"/>

enter image description here

sanket kumar
  • 15.6k
  • 2
  • 29
  • 60