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

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

added 184 characters in body
Source Link
Sandy
  • 7
  • 1
  • 8

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

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 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

Formatted code.
Source Link
Sander de Jong
  • 4.5k
  • 10
  • 65
  • 126

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 -

 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 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 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

Source Link
Sandy
  • 7
  • 1
  • 8
Loading