I am using a <lightning:datatable>
to display some data in a Quick Action
. It works great, and I was able to get the table to display the name of a parent record as a link using a column definition looking like:
columns = [{
label: "Parent",
fieldName: "ParentLink",
type: "url",
typeAttributes: {
label: {
fieldName: ParentName
}
}
}, {
...
}]
And in my callback for the server function which retrieves the record, I have some code looking like:
const records = response.getReturnValue();
records.forEach(function (record) {
record.ParentLink = "/" + record.ParentId,
record.ParentName = record.Parent.Name
});
Functionally, this approach does everything we need, but the user experience is not optimal. The anchor tag which gets rendered on the page looks like:
<a href="/parentId" title="/parentId" target="_blank">ParentName</a>
Is there any way I can control the title
and target
attributes? The latter is the major problem, because opening the record in a new tab is antithetical to the navigation paradigm in Lightning Experience. Given that it is a Quick Action
modal, I would prefer it to be target="_top"
.