You need to sign in to do that
Don't have an account?
Valentina 5
Need urgent help Lightning datatable
Lightning datatable does not reflect Account.Name, Owner.Name, Created By. Name. what is the error?
doInit : function(component, event, helper) {
component.set('v.mycolumns', [
{label: 'Account Name', fieldName: 'Name', type: 'text',sortable: true},
{label: 'Email', fieldName: 'Email', type: 'Email', sortable: true},
{label: 'Contact Level', fieldName: 'Contact_Level__c', type: 'picklist',sortable: true},
{label: 'Account', fieldName: 'Account.Name', type: 'text',sortable: true},
{label: 'Owner', fieldName: 'Owner.Name', type: 'text',sortable: true},
{label: 'Created By', fieldName: 'CreatedBy.Name', type: 'text', sortable: true},
{label: 'Created Date', fieldName: 'CreatedDate', type: 'data',sortable: true},
{label:'Action',type: 'button',typeAttributes:
{iconName: 'utility:view',label: 'Del',name: 'Del', disabled: false,value: 'viewBtn'}
}
]);
doInit : function(component, event, helper) {
component.set('v.mycolumns', [
{label: 'Account Name', fieldName: 'Name', type: 'text',sortable: true},
{label: 'Email', fieldName: 'Email', type: 'Email', sortable: true},
{label: 'Contact Level', fieldName: 'Contact_Level__c', type: 'picklist',sortable: true},
{label: 'Account', fieldName: 'Account.Name', type: 'text',sortable: true},
{label: 'Owner', fieldName: 'Owner.Name', type: 'text',sortable: true},
{label: 'Created By', fieldName: 'CreatedBy.Name', type: 'text', sortable: true},
{label: 'Created Date', fieldName: 'CreatedDate', type: 'data',sortable: true},
{label:'Action',type: 'button',typeAttributes:
{iconName: 'utility:view',label: 'Del',name: 'Del', disabled: false,value: 'viewBtn'}
}
]);
we cannot access parent record data using dot notation directly.Data has to be flatten on client side or server side.
Please refer below link which might help you further
https://salesforce.stackexchange.com/questions/200761/parent-field-in-lightning-datatable
Hope this helps you
If this helps kindly mark it as solved so that it may help others in future.
Thanks and Regards