You need to sign in to do that
Don't have an account?
Katie Kourtakis
LWC - Datatable Does not Dispaly Data
Hi, I'm trying to create an LWC that displays a datatable of records from a custom obect called Match__c. I want to display the record Id, the participant, and volunteer fields in the datatable where the field volunteer job on the Match record equals the record id of the page being viewed. I created an apex controller to pull the data. The table will not display any data even though I have permissions to the object/fields. On load the console displays "DevTools Failed to Load Source Map". Here are some pictures:
Apex Controller
JS
HTML
Component
Any help would be appreciated. This is my first LWC.
Apex Controller
JS
HTML
Component
Any help would be appreciated. This is my first LWC.
1) @wire(getMatchList, { recId: '$recordId' }) => the position of the parameter is not sufficient, the name of the field must be the same in Apex.
2) It is more likely: Volunteer__r.Name (it is a lookup field)
3) You just need to convert the result of the request (implicit fields data and error) into the fields associated with the columns ( Process record data )
You have used the short format but it is better to track the error too with an extended wiredRecord.
https://developer.salesforce.com/docs/component-library/documentation/en/lwc/data_error
4) data={match} is sufficient.
All Answers
Can you try checking if you are receiving the records in the apex class? in case if you are receiving the records then the error might be with the component. wherein you try checking if you are receiving the records from the apex class.
Do let me know if this helps.
Regards,
Anutej
You should post your text code by using the button: "< >" [ Add a code sample ]
There are some errors and it is faster to fix them quickly by copy/paste a text (impossible with an image)
Volonteer__c is a lookup field (reference) probably?
Your LWC component is inside a record detail page?
Sorry about the images. The Volunteer_Job__c on the Match object is not a lookup field. It is a formula field that holds the Volunteer Job Id that comes from a different object connected to the Match object. The LWC component is located on the Volunteer Job record detail page. Hope that helps. I also tried taking away the WHERE clause in my SOQL statement and running the code but it still didn't produce any results.
It is just the button in yellow above.
HTML
JS
Apex Class
Thanks
1) @wire(getMatchList, { recId: '$recordId' }) => the position of the parameter is not sufficient, the name of the field must be the same in Apex.
2) It is more likely: Volunteer__r.Name (it is a lookup field)
3) You just need to convert the result of the request (implicit fields data and error) into the fields associated with the columns ( Process record data )
You have used the short format but it is better to track the error too with an extended wiredRecord.
https://developer.salesforce.com/docs/component-library/documentation/en/lwc/data_error
4) data={match} is sufficient.
Your last posted code was already much better.
You made the effort to learn and you were able to apply your knowledge yet with just a ltttle help for the final step because the documentation is not sufficient for one part especially. The process of the record data is missing with an example in the documentation of Salesforce and the short form exists elsewhere so many people are confused at the beginning.