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
SFDC INSFDC IN 

Accessing the current record from the HTML table in JS file using Lightning Web Component

Hi folks,

I am displaying the records from the custom object test__c using html table in LWC. 
I am using this below tag to iterate over the list of records.

<tbody>
<template for:each={testList} for:item="test">
<tr key={test.Id}>
<td>
{data}
</td>

I want to access the current item (for:item="test") in js file.

Like, in js, I am giving

@track record = {};
@track field;

I want (for:item="test") record data to populate in the @track record property.

Can anyone help me with this ?


 
ArleneArlene
We need a little bit more information from you, and hopefully then we can help.  You have a list of records, and you want to access one of those records in the javascript file.  How do you know which record is the current record?  Will the user click on on the row to make it the current record?
SFDC INSFDC IN
Hi Arlene,
Thanks for responsing.

I have checkbox in one of the columns to select the data and use that data to send the as email. Can you help on this?