You need to sign in to do that
Don't have an account?
shalini sharma 24
placing the custom managed component in the dynamically created tab
Hi,
I want to place the managed package component (we can find this component under custom - managed in lightning app builder) inside the dynamically created Tab. How can this be done?
I want to place the managed package component (we can find this component under custom - managed in lightning app builder) inside the dynamically created Tab. How can this be done?
You can do this by using nameSpace: Component. For example, Your managed package namespace is test and component name is demoComp then you can include like test:demoComp
Regards,
Amit
If you see the attached the screenshot, i am using the sharinPix component (you can find this under custom - managed in my screenshot). When i am placing this sharinPix component directly on the lightning page, the component works fine (i.e. i get the option to upload image and i am able to upload the image - refer screenshot 2).
But when i am placing this component under my dynamically created Tab (given below is the code), its not working. Although i am not getting any error but i dont get the option to upload the image (refer below screenshot) .
doInit: function(component, event, helper)
{
var cmpId = component.get("v.recordId");
var stage = component.get("v.stage");
var actiondisplay = component.get("c.fetchStage");
actiondisplay.setParams({
"ComponentId": cmpId,
});
actiondisplay.setCallback(this,function(response)
{
var state=response.getState();
var result=response.getReturnValue();
if(state === "SUCCESS"){
component.set("v.stage",response.getReturnValue());
var stage = component.get("v.stage");
if(stage == "Pre Prod"){
$A.createComponent("lightning:tab", {
"label": "Revision1",
"id": "new",
"onactive": component.getReference("c.addContent")
}, function (newTab, status, error) {
if (status === "SUCCESS") {
var body = component.get("v.moretabs[0]");
component.set("v.moretabs[0]", newTab);
} else {
throw new Error(error);
}
});
$A.createComponent("lightning:tab", {
"label": "Revision2",
"id": "new",
"onactive": component.getReference("c.addContent")
}, function (newTab, status, error) {
if (status === "SUCCESS") {
var body = component.get("v.moretabs[0]");
component.set("v.moretabs[0]", newTab);
} else {
throw new Error(error);
}
});
}
else if(stage == "s2"){
$A.createComponent("lightning:tab", {
"label": "Revision3",
"id": "new",
"onactive": component.getReference("c.addContent")
}, function (newTab, status, error) {
if (status === "SUCCESS") {
var body = component.get("v.moretabs[0]");
component.set("v.moretabs[0]", newTab);
} else {
throw new Error(error);
}
});
}
}
});
$A.enqueueAction(actiondisplay);
},
addContent : function(component, event) {
var tab = event.getSource();
var cmpId = component.get("v.recordId");
alert("cmpID 2"+cmpId);
var evt = $A.get("e.c:passRecId");
evt.setParams({"Pass_Id":cmpId});
evt.fire();
switch (tab.get('v.id')){
case 'new':
$A.createComponent("sharinPix:SharinPix", {
}, function (newContent, status, error) {
if (status === "SUCCESS") {
tab.set('v.body', newContent);
} else {
throw new Error(error);
}
});
break;
}
}
})