I am using @wire
and getListUi
to get a list view of accounts. I have a lightning-datatable
where, for now, I just want to display the name of each account.
Relevant part of the template:
<template if:true={listView.data}>
<lightning-datatable
key-field="id"
data={accounts}
columns={columns}>
</lightning-datatable>
</template>
Here is my JS code with @wire
and getter for accounts:
import { LightningElement, wire } from 'lwc';
import { getListUi } from 'lightning/uiListApi';
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
const columns = [
{
label: 'Account Name',
fieldName: 'Name',
type: 'text'
}
];
export default class AccountExample extends LightningElement {
columns = columns;
@wire(getListUi, {
objectApiName: ACCOUNT_OBJECT,
listViewId: '00B5I000001O1O3UAK',
pageSize: 5
})
listView;
get accounts() {
console.log(JSON.stringify(this.listView.data.records.records, null, 4));
return this.listView.data.records.records;
}
}
In the console.log()
statement I am seeing all of the values I expect. The lightning-datatable
does appear to be populated but there is not text showing up. It's as if the text is the same colour as the datatable
background.
I have seen a few questions on here with a similar problem however they are using uiRecordApi