3

I have a blank Lightning component which I am using as a custom tab in Service Console. While the content loads fine the tab label stays on "Loading..." forever.

Component enter image description here

Tab enter image description here

Screen enter image description here

There are no errors in the Chrome console. What am I doing wrong?

UPDATE The label displays fine if I add the same tab to my custom app.

  • Any errors in the JavaScript console? – Keith C Jun 23 '17 at 17:02
  • @KeithC no errors. – Mossi2 Jun 23 '17 at 19:19
  • 1
    Maybe this is not problem this component but one of AccountSearch or AccountSearchList. Can you add code of them and picture with your custom tab settings? – JJanek Jun 24 '17 at 21:18
  • @JJanek I have tried removing the body and still seeing the same behaviour. So the issue doesn't seem to be related to other components. – Mossi2 Jun 27 '17 at 22:06
  • @KeithC here's an update: this seems to be only happening with Lightning tabs in Service Console. If I add the tab to my own custom app the label shows fine. – Mossi2 Jun 28 '17 at 18:53
1

Put this line in Component.

//in markup
<lightning:workspaceAPI aura:id="workspace"/>

In Component init:

    //Js Controller
    var workspaceAPI = component.find("workspace");
    workspaceAPI.getFocusedTabInfo().then(function(response) {
        var focusedTabId = response.tabId;
        workspaceAPI.setTabLabel({
            tabId: focusedTabId,
            label: "Edit Contact" //set label you want to set
        });
        workspaceAPI.setTabIcon({
            tabId: focusedTabId,
            icon: "utility:add_contact", //set icon you want to set
            iconAlt: "Edit Contact" //set label tooltip you want to set
        });
    })

Hope this will help you.

0

It looks like it is now possible to set the Tab Label using the Lightning Console JavaScript API (GA as of Winter 18).

setTabLabel() for Lightning Experience

The example in the documentation uses a button to update the tab label, but you could just as easily set it on init of the component.

0

Add a line in component :

<lightning:workspaceAPI aura:id="workspace"/>

Add the following code to the js controller of the component:

doInit : function(component, event, helper) { var workspaceAPI = component.find("workspace"); workspaceAPI.openTab({ url : '/lightning/n/yourcomponentnamefromurl', focus: true }).then(function(response){ workspaceAPI.setTabLabel({ tabId: response , label: "Label for tab" }) });

This would avoid the condition of tab label changed to some other custom tab label when a second tab is opened.

  • 1
    Please avoid asking for upvotes in your posts, it is not relevant to the answer. Thanks – glls Aug 28 '18 at 17:21

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.