Skip to main content The Trailblazer Community will be unavailable from 2/1/2025 to 2/2/2025. Please plan your activities accordingly.
error

We made a wrong turn. Try again.

Hi,

I awant to validate the data in a editable data table cell change event

<lightning-datatable                                                

        key-field="id"

        data={data}

        show-row-number-column

        row-number-offset={rowOffset}   

        onrowaction={handleRowAction}

        onsave={handleSave}

        columns={columns}

        oncellchange={validatecelldataset}

        draft-values={draftValues}

        errors={error}

>

In JS file 

validatecelldataset(event){ 

        console.log('Cell Data  : ' +JSON.stringify( event.detail.draftValues[0]));        

    }

How to validate the above data and send an error message.

In the columns array i do have the column name type, lenght, so the validations that I am looking for is to check against the data type and length in the JS method.

Tahnk you
3 answers
0/9000