You need to sign in to do that
Don't have an account?
Juan García
Lightning datatable link
Hi,
I have a datatable, and I need a text column with hiperlink to the reference object.
I want a similar table to a standard list view, the name of the column record is a hiperlink of the record page
Example:
List view of a record:
Datatable with a colum type url
Datatable with a colum type text
Code:
Thanks
I have a datatable, and I need a text column with hiperlink to the reference object.
I want a similar table to a standard list view, the name of the column record is a hiperlink of the record page
Example:
List view of a record:
Datatable with a colum type url
Datatable with a colum type text
Code:
cmp.set('v.columns', [ {label: 'Recurso', fieldName: 'Name', type: 'url', sortable: true, editable:'true', initialWidth: 120}, ]);
Thanks
You need two fields: a shown label and a value for the underlying url.
Component:
cmp.set('v.columns', [
{
label: 'My Column Label',
fieldName: 'myUrlField',
type: 'url',
typeAttributes: { label: {fieldName: 'myLabel'}},
sortable:false
},
... ]);
Controller:
myUrlField = '/one/one.app?#/sObject/' + item.Id + '/view';
myLabel = 'My test of label':
All Answers
You need two fields: a shown label and a value for the underlying url.
Component:
cmp.set('v.columns', [
{
label: 'My Column Label',
fieldName: 'myUrlField',
type: 'url',
typeAttributes: { label: {fieldName: 'myLabel'}},
sortable:false
},
... ]);
Controller:
myUrlField = '/one/one.app?#/sObject/' + item.Id + '/view';
myLabel = 'My test of label':
Thank you very much. It works correctly.
Regards
Create Custom formula field.
Formula:
LEFT($Api.Partner_Server_URL_260, FIND( '/services', $Api.Partner_Server_URL_260)) + 's/detail/' + Id]
Put the field in Apex SOQL query
Then this code will be working.
{label: 'Case Number', fieldName: 'Show_Case__c', type: 'url',sortable: true,typeAttributes: {label:{ fieldName: 'CaseNumber'}}}
https://salesforce.stackexchange.com/questions/216841/record-url-in-lightningdatatable-in-community
Replacing (one/one.app?#/sObject) with (/lightning/o/).
Why is Salesforce making this change?
To improve URL readability and address the issue of being directed to an unexpected location when accessing Lightning Experience URLs before authenticating.
What happens to links I’ve saved, or see in email?
Don’t panic! The existing URLs will work for the foreseeable future. Links that you’ve saved or have in emails will be translated into the new enhanced URL format when they’re executed. If you have the enhanced URL format enabled for your org, that format is what you see in the browser address bar.
https://help.salesforce.com/articleView?id=000269064&language=en_US&type=1
These are equivalent alternatives and (one/one.app?#/sObject) is not the best nowadays indeed.
https://www.codekiat.com/2019/08/salesforce-lightning-datatable-example-with-lwc-lightning-web-component.html