2

The hyperlink/Url in LightningDataTable is not opening in a new primary tab. Instead, it's opening in a subtab in lightning console. I have tried "_self" and "_blank". Blank is opening in new browser tab. Self is opening in new subtab. Is there any option to open this in a new primary tab?

({
init: function (cmp, event, helper) {
    cmp.set('v.columns', [
        {label: 'Id', fieldName: 'Id', type: 'text' , editable: false,initialWidth: 200,cellAttributes: { class: { fieldName: 'impactToPool_class,background_class'}}}, 
         {label: 'Account Name', fieldName: 'linkName', type: 'url', 
        typeAttributes: {label: { fieldName: 'Name' }, target: '_self'}},
        {label: 'Annual Revenue', fieldName: 'AnnualRevenue', type: 'currency' ,editable: false,initialWidth: 200,cellAttributes: { class: { fieldName: 'background_class' }},typeAttributes: { minimumFractionDigits:0}},
        {label: 'Description', fieldName: 'Description', type: 'text' ,editable: false,initialWidth: 200,cellAttributes: { class: { fieldName: 'background_class' }}}
    ]);
    helper.fetchData(cmp,event, helper);
})

({
fetchData: function (cmp,event,helper) {
    var action = cmp.get("c.getAllAccounts");
    action.setCallback(this, function(response) {
        var state = response.getState();
        if (state === "SUCCESS") {
            var data = response.getReturnValue();
            data.forEach(function(record){
                record.linkName = '/'+record.Id;
            });
    });
    $A.enqueueAction(action);
})
1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.