+ Start a Discussion
Sergio Mac IntoshSergio Mac Intosh 

LWC Apex Query Doesnt work

I have issues with a simple call to get records in Apex controller. I cant get the data in my LWC. The Apex Controller is being called correctly and the response is also correct.
 
import { LightningElement, wire } from 'lwc';

import LabelChooseTarget from '@salesforce/label/c.Choose_a_target';
import LabelCreateNewLabel from '@salesforce/label/c.Create_New';

import FIELD from '@salesforce/schema/Target_Configuration__c.Name';

import getAllConfigurations from '@salesforce/apex/ConfigurationController.getAllConfigurations';

const COLUMS = [
    {label : 'Name', fieldName : FIELD.fieldApiName, type: 'text'}
];


export default class ConfigurationSelector extends LightningElement {
    column = COLUMS

    label = {
        LabelChooseTarget
    };

    @wire(getAllConfigurations)
    configurations;

}
 
<template>
    <lightning-card  icon-name="custom:custom83" title={label.LabelChooseTarget}>

        <template if:true={configurations.data}>

        <lightning-datatable
            key-field="Id"
            data={configurations.data}
            colums={colums}>
        </lightning-datatable>

        </template>
    </lightning-card>
</template>



 
Gaurav Sharma 472Gaurav Sharma 472
n is missing from columns.

 <lightning-datatable
            key-field="Id"
            data={configurations.data}
            columns={colums}>
1      </lightning-datatable
Gaurav Sharma 472Gaurav Sharma 472
One more thing noticed. There is no function defined in js file. Either create a button and populate configurations inside button function or Population configurations under connectedcallback function. As there is no action defined so it is empty in html file