Getting values from table row on click

PHOTO EMBED

Thu Jul 11 2024 01:58:55 GMT+0000 (Coordinated Universal Time)

Saved by @gbritgs

<div class="data-list">
    <template for:each={data} for:item="item">
        <div key={item.code} class="data-item" data-code={item.code} data-name={item.name} data-volume={item.volume} onclick={handleItemClick}>
            <strong>{item.code}</strong><br />{item.name}<br />{item.volumeFormatted}
        </div>
    </template>
</div>

handleItemClick(event) {
this.MCCObj = {
code: event.currentTarget.dataset.code,//nome dos campos 
name: event.currentTarget.dataset.name,
volume: event.currentTarget.dataset.volume
}

this.selectedMCC = this.MCCObj.code + ' - ' + this.MCCObj.name;
}
content_copyCOPY