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
Shavi DabgotraShavi Dabgotra 

How to make a name as url and clickable using lightning data table?

Hi all,
How can I make a column clickable in lightning data table to get the name?
Thank you in advance!
CharuDuttCharuDutt
Hiii Shavi Dabgotra
Try the Following Code Copy Paste
const columns = [{  
    label: "Name",  
    fieldName: "recordLink",  
    type: "url",
    typeAttributes: { label: { fieldName: "Name" }, tooltip:"Name", target: "_blank" }  
   }
];
export default class test extends LightningElement {
    error;
    data;
    columns = columns;
    wiredActivities;
   

    /*Calling Apex Class*/
    @wire(ClassName, {

    })
    wiredclass(value){
        this.wiredActivities = value;
        const { data, error } = value;
        if (data) { 
            var ObjData = JSON.parse(JSON.stringify(data));
            this.records = ObjData.length;
         ObjData.forEach(Record => {
            Record.recordLink = "/" + Record.Id;  
            Record.Name = Record.Name;
            
            });
            
     
            this.data = ObjData;
            this.error = undefined;  
           } else if (error) {  
            this.error = error;  
            this.data = undefined;
           }  
    }


Please Mark it As Best Answer If it helps
Thank You​​​​​​​!