I am trying to run an Event on my Child Component when the Datable row is selected on my Parent Component.
When I run with the code below I am getting an error
Here is the Event code from my Child Component
handleCancel(event){
const inputFields = this.template.querySelectorAll( 'lightning-input-field' );
if ( inputFields ) {
inputFields.forEach( field => {
field.reset();
this.showSaveButton = false;
} );
}
}
Here is the Event code from my Parent Component
handleRowSelection(event){
var selectedRows=event.detail.selectedRows;
if(selectedRows.length>1)
{
var el = this.template.querySelector('lightning-datatable');
selectedRows=el.selectedRows=el.selectedRows.slice(1);
event.preventDefault();
return;
}
this.werRecordId = selectedRows[0].Id;
this.template.querySelector('c-work-experience-record-page').handleCancel(event.target.value);
this.werSelectedRow=true;
}