2

I am having a visualforce page inside which I am using a lightning component. Its shown below

            $Lightning.use("c:VFPage", function() {
                $Lightning.createComponent(
                    "c:EditAttachment",
                    {
                        attachmentId: attId,
                        attachmentName: attName,
                        attachmentDesc: attDesc,
                        isPrivate: isPrivate
                    },
                    "LightningContainer",
                    function(cmp) {
                    }
                );
            });

Inside the lightning component, I am performing an edit on Attachment record and saving it.

I want to reload the whole visualforce page after the saving of the attachment is successful. Is there any way to do this?

1 Answer 1

5

Simply Use location.reload();on the Success callback of the Attachment/record Save.It reloads the page.

You can also pass the attributes from lightning component to VF page by Fire the Navigate event to handle it on the VF page, Like this

Controller:

var objectHomeEvent = $A.get("e.force:navigateToObjectHome");
objectHomeEvent.setParams({

    scope: component.get('v.List')

});
objectHomeEvent.fire();

VF Page:

$Lightning.use("c:sObjectFilterApp", function() {
    $Lightning.createComponent("c:sObjectFilter",
    { label : "Press Me!" },
    "lightning",
    function(cmp) {

        $A.eventService.addHandler({
              event: 'force:navigateToObjectHome',
              handler: function(cmp,event) {

                   console.log(cmp.qc.scope);               
              }
        });

    });
});

But It was somewhere like hacking. The Only Happy path was Handling the Navigate event, not getting params.

2
  • Thanks for the answer. I know that this will work. Is there any way to pass something from lightning component to visualforce page ? Commented Jan 31, 2018 at 4:47
  • 1
    Yes, Of course. I edited the answer. Please take a look.
    – am_Aravi
    Commented Jan 31, 2018 at 10:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .