I have fetched all the fields to be displayed on the datatable in my apex query.
In my js file where i store the column details
@track columns = [{
label: 'Deal Name',
fieldName: 'Marketing_Activity__r.Name',
type: 'text'
},
{
label: 'Deal Type',
fieldName: 'Deal_Type__c',
type: 'text'
},
{
label: 'Rent',
fieldName : 'Rent__c',
type: 'currency'
},
{
label: 'Term',
fieldName : 'Term_Mos__c',
type: 'number'
},
{
label: 'Security Deposit',
fieldName: 'Aircraft__r.Lease__r.Security_Deposit_Amount_Cash_or_LOC__c',
type: 'currency'
}
It fetches value for rent,term and deal_type. but not for Security deposit and Deal Name.
Any suggestions???
How to display the above details on the datatable in lwc?
Best Answer
You can't traverse relationships in the fieldName attribute. Instead, you would need to map the data beforehand, then use that field's name.
Then, for your data table columns: