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
Mike Tol 1Mike Tol 1 

Autosave columns

I need to create a TITLE and PHONE columns with autosave. When entering the new value of the field this value should be saved in the database automatically (user should not click on some button) like on this image:

User-added image

Please tell me how can I do that.
My code:

    <lightning-card title="Leads">
        <lightning-layout multiple-rows="true" vertical-align="end">
            <lightning-layout-item size="12" padding="around-small">
                <lightning-datatable key-field="id" data={leads} columns={columns}></lightning-datatable>

import { LightningElement , wire} from 'lwc';
import getLeads from '@salesforce/apex/Qqq.getLeads';
const columns = [
    { label: 'Name', fieldName: 'recordLink', type: 'url',
    typeAttributes: {label: {fieldName: "LeadName"}, tooltip: "Name", linkify: true} },
    { label: 'Title', fieldName: 'Title', type: 'text', editable: true },
    { label: 'Phone', fieldName: 'Phone', type: 'text', editable: true }    
export default class LeadTable extends LightningElement {
    columns = columns;
    wiredLeads(value) {
        const {error, data} = value;
        if (data) {
            let leadData = JSON.parse(JSON.stringify(data));  
            leadData.forEach(record => {
                                record.recordLink = "/" + record.Id;  
                                record.LeadName = record.Name;
            this.leads = leadData;
        } else if (error) {
            this.error = error;

public with sharing class Qqq {
    public static List<Lead> getLeads() {
        List<Lead> leads = [
            SELECT Id, Name, Title, Phone
            FROM Lead          
        return leads;                
Santoshi K VSantoshi K V
Hi Mike

check the above link. It may be useful for you. If yes, please mark as the best answer,

Thanks in advance
Mike Tol 1Mike Tol 1
Thank you Santoshi ! But unfortunately I don't work with aura... Can you please advise how to do something like this in Lwc?