I want to open multiple subtabs with lightning component content in lightning Console with different parameters. Each time I call openSubtab, a new subtab should open event if there is already a subtab opened with parameters from another record.
But with my code, event if the "state" parameters changes, if there is a subtab with the same lightning component opened, the existing subtab get focused
here is my code, please help me
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": {
"uid": "1",
"c__name": component.get("v.recordId"),
"caseId" : component.get("v.recordId"),//case id
"orderId" : createQuoteResponse.orderId,
"accountId" : createQuoteResponse.accountId,
"priceBookId": createQuoteResponse.priceBookId,
"clientObj": createQuoteResponse.clientJSON,
"contactObj": createQuoteResponse.contactJSON
},
},
recordId:createQuoteResponse.orderId,
focus:true
}).then(function(subtabId) {
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.focusTab({tabId : subtabId});
}).catch(function(error) {
console.log("error");
});
});