Skip to main content
4 of 4
Fixed typo in title
Sander de Jong
  • 4.5k
  • 10
  • 65
  • 126

Need to get row value from datatable in JS in LWC, but unable to get it

I have simple datattable where i am displaying couple of columns ,on click of any row in datatable i need to get the value from Name column to JS for further processing

<template>
<lightning-datatable
        data={data}
        columns={columns}
        key-field="id"
        onrowselection={getNameRowData}>
</lightning-datatable>

JS -

getNameRowData(event) {
    const selectedRows = event.detail.selectedRows;
    console.log('selectedRows>>'+selectedRows);
}

but i am not able to see any logs printing in console.Please help i dont want checkbox ,just when i click on any row then that perticular opp Name needs to get in JS

enter image description here

Sandy
  • 7
  • 1
  • 8