How to Use Wrapper Class In Salesforce Lightning Component?

How to Use Wrapper Class In Salesforce Lightning Component?

How to Use Wrapper Class In Salesforce Lightning Component?

A wrapper or container class is a class, a data structure, or an abstract data type which contains different objects or collection of objects as its members.

A snippet of code for Wrapper Class :

Screenshot from 2018-04-06 12-13-31

To use a variable in lightning use @AuraEnabled Annotation  before the variable name. Above wrapper class can be use to show account Details and all its related contact.

A snippet of code for Lightning  Component :

component1

comp

component3

JavaScript Controller for Lightning component :

LightningController

 

Helper For Lightning Component :

LightningHelper

Salesforce Apex Controller :

ApexController

The above lightning component is embedded in a visual force page.

A snippet of code for Salesforce Visualforce Page :

Developer Console

Your Lightning Component Look like Below ScreenShot :

AccountWrap

References:

https://salesforce.stackexchange.com/questions/117627/wrapper-class-knowledgearticleversion-knowledgearticle-for-caseassociation-c

http://sfdcmonkey.com/2017/07/06/use-wrapper-class-lightning-component/

Popular Salesforce Blogs