function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Raghu Ch 2Raghu Ch 2 

Lightning Data Table Not pulling data

Hi,

Lightning data table not pulling the data. rows are comming as blank. I am trying to display the picklist values of Type field on the account. Code below:

HTML File:
<template>
            <lightning-datatable
            key-field="Id"
            columns={columns}
            data={picklistValues.data.values}>
    
            </lightning-datatable>


</template>

JS File:
import {
    LightningElement,
    wire
} from 'lwc';
import {
    getPicklistValues
} from 'lightning/uiObjectInfoApi';
import TYPE_FIELD from '@salesforce/schema/Account.Type';


export default class Picklistvalues extends LightningElement {

    columns = [
        { label: 'Id', fieldName: 'Id', type: 'Id' },
        { label: 'Account Type', fieldName: TYPE_FIELD.fieldApiName, type: 'text' }
    ];


    @wire(getPicklistValues, {
        recordTypeId: '012o0000000qnHlAAI',
        fieldApiName: TYPE_FIELD,
    })
    picklistValues;
}
mukesh guptamukesh gupta
HI Raghu,

first you need to check picklist values in js file:-
 
@wire(getPicklistValues, {
        recordTypeId: '012o0000000qnHlAAI',
        fieldApiName: TYPE_FIELD,
    })
wirePickList({ error, data }) {
        if (data) {
           console.log('===>>>> '+JSON.stringify(data.values));
        } else if (error) {
            console.log(error);
        }
    }