1

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?

4

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.

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

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.