Lightning Web Component (LWC) Examples: Add Hyper Link Url For Name Column/Field In lightning Data Table ExampleHello guys, in this post we are going to see how to add hyper link url for lwc data table. As we know that if we use lightning-datatable tag we can show list of records data in table. But for name field if we use type:"text" we can't show clickable hyper link for record name on lightning Data Table. If we want display any field or column with link we need to make some tweaks on data what we are going to display on table. So that we can show link and once we click on that it will takes you to respective record page. Check below example code.
Hyper Link For Name field In lightning-datatable in LWC:
Create apex class: OpportunityController
Create Lightning Web Component with name lwcDataTableHyperLink:
If we see above code we are not assigning wire function data directly to oppList property, instead we are modifying every record to assign link for Name column (tempRecord.recordLink = "/" + tempRecord.Id;).