You need to sign in to do that
Don't have an account?
shalini sharma 24
visualforce page inside dynamically created lightning tab
Hi,
I am creating lightning tabs dynamically from inside the lightning client side controller.
How can i put my visualforce page inside these tabs?
I am creating lightning tabs dynamically from inside the lightning client side controller.
How can i put my visualforce page inside these tabs?
You can use the iframe to show the VF page inside the Lightning tab. Set the Iframe content from the Controller as body attribute.
Regards,
Amit
All Answers
You can use the iframe to show the VF page inside the Lightning tab. Set the Iframe content from the Controller as body attribute.
Regards,
Amit
Thanks for your reply. I added VF page as a IFrame , see the below code. But i cant see my VF page on UI.
({
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();
alert('result++>'+result);
if(state === "SUCCESS"){
alert("success");
alert('result++>'+result);
component.set("v.stage",response.getReturnValue());
var stage = component.get("v.stage");
if(stage == "s1"){
alert("inside if");
$A.createComponent("lightning:tab", {
"label": "Tab1",
"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": "Tab2",
"id": "new",
"onactive": component.getReference("c.addContent")
}, function (newTab, status, error) {
if (status === "SUCCESS") {
var body = component.get("v.moretabs[1]");
component.set("v.moretabs[1]", newTab);
} else {
throw new Error(error);
}
});
}
else if(stage == "s2"){
$A.createComponent("lightning:tab", {
"label": "Tab1",
"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");
switch (tab.get('v.id')){
case 'new':
"label": "OLD"
$A.createComponent("iFrame", {
"src" : "{!'https://toons-dev-ed.lightning.force.com/apex/sharinPixComponent?Id=' +cmpId}" ,
"width" : "100%"
}, function (newContent, status, error) {
if (status === "SUCCESS") {
tab.set('v.body', newContent);
} else {
throw new Error(error);
}
});
break;
}
}
})
Please turn the debug log on and then see if there is information