Im new to LWC development and am trying to get through an issue Im having. I want to use a custom class list to display a list of data in a data table. The data that Im populating manually (at the moment) is not displaying. Any advice is appreciated. Thank you for your time!
onboardingPeople.html
<template>
<lightning-card title="Handle Error" icon-name="standard:contact">
<template if:true={error}>
<p>{error}</p>
</template>
</lightning-card>
<lightning-card title="People">
<lightning-datatable data={people} columns={columns} key-field="accountid"></lightning-datatable>
</lightning-card>
</template>
onboardingPeople.js
import { LightningElement, wire, track, api} from 'lwc';
import getpeople from '@salesforce/apex/Onboarding.getpeople';
export default class OnboardingPeople extends LightningElement {
@api people = [];
@track error;
@track columns = [
{
label: 'First Name',
fieldName: 'nameUrl',
type: 'url',
typeAttributes: {label: { fieldName: 'firstname' },
target: '_blank'},
sortable: true
},
{
label: 'Last Name',
fieldName: 'lastname',
type: 'text',
sortable: true
}
];
@wire(getpeople,{recordId:'$recordId'})
wiredPeople({error, data}){
if(data){
this.people = data;
this.error = undefined;
} else if (error) {
this.people = undefined;
this.error = error;
}
}
}
Onboarding.cls
public with sharing class Onboarding {
@AuraEnabled(cacheable=true)
public static List<OnboardingPeopleResult> getpeople(String recordId) {
List<OnboardingPeopleResult> oprList = new List<OnboardingPeopleResult>();
OnboardingPeopleResult oprobj = new OnboardingPeopleResult();
oprobj.accountid = '123';
oprobj.firstname = 'Tom';
oprobj.lastname = 'Snow';
oprobj.nameUrl = '/'+oprobj.accountid;
oprList.add(oprobj);
return oprList;
}
}
Custom Class
public class OnboardingPeopleResult {
@AuraEnabled
public String accountid {get;set;}
@AuraEnabled
public String firstname {get;set;}
@AuraEnabled
public String lastname {get;set;}
@AuraEnabled
public String nameUrl {get;set;}
public OnboardingPeopleResult() {
this.accountid = '';
this.firstname = '';
this.lastname = '';
this.nameUrl = '';
}
}

