Регистрация  |  Вход

Немогу получить доступ к вложенному объекту через JS

Не могу получить доступ к Account.Name, Owner.Name,CreatedBy.Name, для вывода данных в столбец
скриншоты с консоли и самого таба
Apex Class

public class SampleController {

//Get Account Records
@AuraEnabled
public static List<Contact> getContacts(String pageSize, String pageNumber){
List<Contact> accList = new List<Contact>();
ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(Database.getQueryLocator('SELECT Name, Email, Contact_Level__c, Owner.Name, CreatedBy.Name, CreatedDate, Account.Name FROM Contact'));
ssc.setpagesize(Integer.valueOf(pageSize));
ssc.setPageNumber(Integer.valueOf(pageNumber));
accList = (List<Contact>)ssc.getRecords();
return accList;
}

//Delete Account
@AuraEnabled
public static void deleteAccount(Contact acc){
Delete acc;
}
}

controller js Ф-ия для таблицы
getColumnAndAction : function(component) {
var actions = [
{label: 'Edit', name: 'edit'},
{label: 'Delete', name: 'delete'},
{label: 'View', name: 'view'}
];
component.set('v.columns', [
{label: 'Name', fieldName: 'Name', type: 'text'},
{label: 'Email', fieldName: 'Email', type: 'email'},
{label: 'Contact Level', fieldName: 'Contact_Level__c', type: 'picklist'},
{label: 'Contact Account', fieldName: 'Account=>Name', type: 'text'},
{label: 'Contact Owner', fieldName: 'OwnerId', type: 'text'},
{label: 'Created By', fieldName: 'CreatedById', type: 'text'},
{label: 'Created Date', fieldName: 'CreatedDate', type: 'text'},
{type: 'action', typeAttributes: { rowActions: actions } }
]);
},

Component
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" controller="SampleController">
<aura:attribute name="data" type="Object"/>
<aura:attribute name="columns" type="List"/>
<aura:attribute name="sortedBy" type="String" default="Name"/>
<aura:attribute name="pageNumber" type="Integer" default="1"/>
<aura:attribute name="pageSize" type="Integer" default="10"/>
<aura:attribute name="isLastPage" type="Boolean" default="false"/>
<aura:attribute name="dataSize" type="Integer" default="0"/>
<aura:attribute name="sortedDirection" type="string" default="asc"/>
<aura:attribute name="isWantToDelete" type="Boolean" default="true"/>
<aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
<aura:renderIf isTrue="{!v.isWantToDelete}">
<c:popupAlertSection/>
</aura:renderIf>
<div class="slds-m-around_xx-large">
<div class="slds-clearfix">
<div class="slds-page-header" role="banner">
<p class="slds-page-header__title">Accounts</p>
</div>
</div>

<lightning:datatable aura:id = "accDT"
columns = "{!v.columns}"
maxRowSelection="{!v.maxRowSelection}"
data = "{!v.data}"
keyField = "Id"
selectedRows = "{!v.selectedRowList}"
onsort="{!c.updateSorting}"
sortedBy="{!v.sortedBy}"
sortedDirection="{!v.sortedDirection}"
onrowaction="{!c.handleRowAction}"/>

<div class="slds-clearfix">
<div class="slds-page-header" role="banner">
<div class="slds-float_right">
<lightning:button label="Prev" iconName="utility:chevronleft" iconPosition="left"
onclick="{!c.handlePrev}" disabled="{! v.pageNumber == 1}"/>
<lightning:button label="Next" iconName="utility:chevronright" iconPosition="right"
disabled="{! v.isLastPage}" onclick="{!c.handleNext}"/>
</div>
<p class="slds-page-header__title">Page {!v.pageNumber} | Showing records from {! ((v.pageNumber-1)*v.pageSize)+' to '+((v.pageNumber-1)*v.pageSize+v.dataSize)}</p>
</div>
</div>
</div>
</aura:component>

Не могу получить доступ к Account.Name, Owner.Name,CreatedBy.Name, для вывода данных в столбец
[url=https://imgur.com/a/xrBbAP8]скриншоты с консоли и самого таба[/url]
[b]Apex Class[/b]
[code]public class SampleController {
     
    //Get Account Records
    @AuraEnabled
    public static List<Contact> getContacts(String pageSize, String pageNumber){
        List<Contact> accList = new List<Contact>();
        ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(Database.getQueryLocator('SELECT Name, Email, Contact_Level__c, Owner.Name, CreatedBy.Name, CreatedDate, Account.Name FROM Contact'));
        ssc.setpagesize(Integer.valueOf(pageSize));
        ssc.setPageNumber(Integer.valueOf(pageNumber));
        accList = (List<Contact>)ssc.getRecords();
        return accList;
    }
     
    //Delete Account
    @AuraEnabled
    public static void deleteAccount(Contact acc){
        Delete acc;
    } 
}[/code]
[b]controller js Ф-ия для таблицы[/b]
[code]
    getColumnAndAction : function(component) {
        var actions = [
            {label: 'Edit', name: 'edit'},
            {label: 'Delete', name: 'delete'},
            {label: 'View', name: 'view'}
        ];
        component.set('v.columns', [
            {label: 'Name', fieldName: 'Name', type: 'text'},
            {label: 'Email', fieldName: 'Email', type: 'email'},
            {label: 'Contact Level', fieldName: 'Contact_Level__c', type: 'picklist'},
            {label: 'Contact Account', fieldName: 'Account=>Name', type: 'text'},
            {label: 'Contact Owner', fieldName: 'OwnerId', type: 'text'},
            {label: 'Created By', fieldName: 'CreatedById', type: 'text'},
            {label: 'Created Date', fieldName: 'CreatedDate', type: 'text'},
            {type: 'action', typeAttributes: { rowActions: actions } } 
        ]);
    },[/code]
[b]Component[/b]
[code]<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" controller="SampleController">
<aura:attribute name="data" type="Object"/>
    <aura:attribute name="columns" type="List"/>
    <aura:attribute name="sortedBy" type="String" default="Name"/>
    <aura:attribute name="pageNumber" type="Integer" default="1"/>
    <aura:attribute name="pageSize" type="Integer" default="10"/>
    <aura:attribute name="isLastPage" type="Boolean" default="false"/>
    <aura:attribute name="dataSize" type="Integer" default="0"/> 
    <aura:attribute name="sortedDirection" type="string" default="asc"/>
    <aura:attribute name="isWantToDelete" type="Boolean" default="true"/>
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    <aura:renderIf isTrue="{!v.isWantToDelete}">
    <c:popupAlertSection/>
    </aura:renderIf>
    <div class="slds-m-around_xx-large">
        <div class="slds-clearfix">
            <div class="slds-page-header" role="banner">
                <p class="slds-page-header__title">Accounts</p>
            </div>
        </div>
         
        <lightning:datatable aura:id = "accDT"
                             columns = "{!v.columns}"
                             maxRowSelection="{!v.maxRowSelection}"
                             data = "{!v.data}"
                             keyField = "Id"
                             selectedRows = "{!v.selectedRowList}"
                             onsort="{!c.updateSorting}"
                             sortedBy="{!v.sortedBy}"
                             sortedDirection="{!v.sortedDirection}"
                             onrowaction="{!c.handleRowAction}"/>
         
        <div class="slds-clearfix">
            <div class="slds-page-header" role="banner">
                <div class="slds-float_right">            
                    <lightning:button label="Prev" iconName="utility:chevronleft" iconPosition="left"
                                      onclick="{!c.handlePrev}" disabled="{! v.pageNumber == 1}"/>
                    <lightning:button label="Next" iconName="utility:chevronright" iconPosition="right"
                                      disabled="{! v.isLastPage}" onclick="{!c.handleNext}"/>
                </div>
                <p class="slds-page-header__title">Page {!v.pageNumber} | Showing records from {! ((v.pageNumber-1)*v.pageSize)+' to '+((v.pageNumber-1)*v.pageSize+v.dataSize)}</p>
            </div>
        </div>
    </div>
</aura:component>[/code]