You need to sign in to do that
Don't have an account?
Siva Reddy 257
Wrapper class in LWC
Hi,
Through LWC I am able to display list of records along with check box in custom table .
Issue is how can I pass only selected records to apex class from lwc like how we pass from aura component to apex class.
Please someone guide me.
Through LWC I am able to display list of records along with check box in custom table .
Issue is how can I pass only selected records to apex class from lwc like how we pass from aura component to apex class.
Please someone guide me.
Try the code snippet as mentioned in the below developer discussion,
https://salesforce.stackexchange.com/questions/255943/how-to-use-wrapper-class-in-lwc
For further reference you can check the below,
https://www.sfdcpoint.com/salesforce/wrapper-class-in-lwc/#:~:text=A%20wrapper%20or%20container%20class,of%20objects%20as%20its%20members.
If it helps mark this the best answer.
In your Lwc Js file copy & paste this following line.
import testClassMethodfrom '@salesforce/apex/testClass.testClassMethod';
var storeListStringData = [];
/*Put all selected data Id in this storeListStringData variable and parse it into apex like following*/
//Apex class
Public class testClass{
public static void testClassMethod(list<string> lstString){
//writer your code
//And in apex class you can query of your selected data like following
List<Account> lstAccount = [SELECT Id,name From Account Where Id In : lstString];
}
}
//how to call apex method from lwc
testClassMethod({'lstString' : ' storeListStringData '}).then(result => {
console.log(result);
}).catch(error => {
console.log(error);
}):
let me know if it helps you and marking it as best.
Thank You
The links which you gave alraedy i have seen , In that link we have code to display records from wrapper class that already I am doing .
I am looking for how to pass the wrapper class data to apex class I hope you understand my requirement.
I will try with your code snippet and will let you know.