How do I retrieve all lwc lightning datatable rows and not just the ones that are editable.
2 of my columns are non-editable (Section__c & Type__c) (coming from custom metadata) and 3 of my columns are editable (Findings, Comments, Location)
const COLS = [
{ label: 'Section', fieldName: 'Section__c' },
{ label: 'Type', fieldName: 'Type__c' },
{ label: 'Findings', fieldName: 'Findings', editable: true },
{ label: 'Location', fieldName: 'Location', editable: true },
{ label: 'Comments', fieldName: 'Comments', editable: true }];
I am using event.detail.draftValues to get the values but they return just the editable fields and only the rows which are edited. However, I need to access the values of entire datatable. I tried this as well but row returns undefined and table data returns this
var table = this.template.querySelector('lightning-datatable');
var rows = table.data;
console.log('table data', table.data);
rows.forEach(function(element){
console.log('row ', element.fieldName);
});
If Event.detail.draftValues returns the edited / changed values in the datatable and not data from Section__c and Type__c columns. In contrast, if I use data attribute then it returns only values from Section__c and Type__c columns.
Is there any way I can retrieve entire table data?