0

I am trying to create a subtab in sales console using below code:-

({
    openTab: function(component, event, helper) {
        var workspaceAPI = component.find("workspace");
        workspaceAPI.getFocusedTabInfo().then(function(response) {
            var focusedTabId = response.tabId;
            workspaceAPI.openSubtab({
                parentTabId: focusedTabId,
                pageReference: {
                    "type": "standard__component",
                    "attributes": {
                        "componentName": "c__myCmp"
                    }
                }
            });
        })
        .catch(function(error) {
            console.log(error);
        });
    }
})

It is opening the subtab correctly, but also opening another subtab called loading.

enter image description here

How we can remove the Loading tab from it?

0

This two functions can do the work workspaceAPI.setTabLabel and workspaceAPI.setTabIcon

var workspaceAPI = component.find("workspace");
            workspaceAPI.getEnclosingTabId().then(function(enclosingTabId) {
                workspaceAPI.openSubtab({
                    parentTabId: enclosingTabId,
                    pageReference: {
                        "type": "standard__component",
                        "attributes": {
                            "componentName": "c__WZ_OrderHeader_Lightning"
                        },
                        "state": {//custom parameters
                            "uid": "1",
                            "caseId" : component.get("v.recordId"),//case id
                            "orderId" : createQuoteResponse.orderId
                        },
                    },
                    focus:true
                }).then(function(subtabId) {
                    // the subtab has been created, use the Id to set the label
                    workspaceAPI.setTabLabel({
                        tabId: subtabId,
                        label: createQuoteResponse.standardOrder.Name
                    });

                    // the subtab has been created, use the Id to set the icon
                    workspaceAPI.setTabIcon({
                        tabId: subtabId, 
                        icon: "standard:orders",
                        iconAlt: createQuoteResponse.standardOrder.Name
                    }); 
                    workspaceAPI.refreshTab({tabId : subtabId,includeAllSubtabs:true});
                    //workspaceAPI.focusTab({tabId : enclosingTabId});
                    workspaceAPI.focusTab({tabId : subtabId});


                }).catch(function(error) {
                    console.log("error");
                });
            });

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.