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

How to get the table row values in LWC

Hello ,
How to update the records using html table in LWC ? .
I'm facing issue with getting complete row values in lwc in my table one of the column is date field and i need to pass the date field value to js controller as well as to serverside controller 

Can someone help me on this , how to update the selected records with input Date field ? 

    <template if:true={accounts}>
        <table class="slds-table slds-table_cell-buffer slds-table_bordered" id="Table1">
                <tr class="slds-line-height_reset">
                    <th class="" scope="col">
                        <div class="slds-truncate" title="Name">Select</div>
                    <th class="" scope="col">
                        <div class="slds-truncate" title="Phone">Name</div>
                    <th class="" scope="col">
                        <div class="slds-truncate" title="select">Phone</div>
                    <th class="" scope="col">
                        <div class="slds-truncate" title="select">Enquiry Date</div>
                <template for:each={accounts} for:item="acc">
                    <tr class="slds-hint-parent" key={acc.Id}>
                        <th data-label="" scope="row">
                            <lightning-input type="checkbox" value={acc.Name} data-id={acc.Id}></lightning-input>
                        <th data-label="Name" scope="row">
                            <div class="slds-truncate">{acc.Name}</div>
                        <td data-label="Rating">
                            <div class="slds-truncate">{acc.Phone}</div>
                        <td data-label=" Enquiry Date">
                            <lightning-input type="date" name="input1" ></lightning-input>
        <lightning-button label="Update Accounts" onclick={updateAccount} style="margin-left: 40%" variant="brand"></lightning-button>

import { LightningElement, track, wire } from 'lwc';
import getAllAccounts from '@salesforce/apex/AccountTablecontroller.getAllAccounts';
export default class Cssexample extends LightningElement {
    @track accounts;
    @track errors;
    @track selectedAcc;
    @track accName ;
    @track accId ;
    }) {
        if (data) {
            this.accounts = data;
        } else {
            this.error = error;
    updateAccount() {
        this.selectedAcc = [];
        let selectedRows = this.template.querySelectorAll('lightning-input');
        for(let i = 0; i < selectedRows.length; i++) {
            if(selectedRows[i].checked ) {
                    Name: selectedRows[i].value,
                    Id: selectedRows[i]

VinayVinay (Salesforce Developers) 
Hi Rama,

Review below examples which can help you to get table row values in LWC

Vinay Kumar