I have tried to search google a lot but no luck, any help would be greatly appreciated. Please note this is not a complete code, I have just pasted just a portions of it to demonstrate my 1 issue which I have explained above. Thanks Lovedeep", "answerCount": 3, "upvoteCount": 0, "datePublished": "2019-03-11T09:39:40.000Z", "author": { "@type": "Person", "name": "Lovedeep Singh", "url": "https://trailblazers.salesforce.com/profileView?u=0053A00000Ds909QAB", "affiliation": { "@type": "Organization", "name": "TCS" } }, "suggestedAnswer": [ { "@type": "Answer", "text": "Hi Lovedeep, So basically you need to rerender your lightning component whenever the value in radio button present on VF page is getting changed. You can try below approach: 1) Use the oncomplete attribute of action support. In the method which gets called on the oncomplete event, make use of postMessage. Using postMessage, you can communicate from a VF page to lightning component. 2) Handle the postMessage in your lightning component and in the postMessage, again call the init method of your lightning component. For information on postMessage, please refer this:  https://developer.salesforce.com/blogs/developer-relations/2017/01/lightning-visualforce-communication.html Thanks, Ravi", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T4MBJSA3", "datePublished": "2019-03-11T10:37:01.000Z", "author": { "@type": "Person", "name": "Ravi Dutt Sharma", "url": "https://trailblazers.salesforce.com/profileView?u=0053000000AmaT2AAJ", "affiliation": { "@type": "Organization", "name": "PayPal" } } } ] } } Skip to main content
Hi All -

I am using a lightning component inside a VF page which is working just fine, there is one scenario explanied below which I am not able to figure out.

I have a section inside VF page which has some radio buttons, I want to refresh my Lightning component which is embedded inside this VF page, because radio button selection changes the data for some of the variables which I am passing to the Lightning component.

Below code gets executed on the radio button selection on the VF page. 

<apex:actionSupport id="supportOnChange" event="onchange" rerender="selectTerritories" status="updatingAvailableTerritories" / >

Below is how I am calling my Lightning component. optionsJSON and  optionsSelectedJSON are the variables whose values are refreshed when a new radio button is selected, so I want to pass this new data every time there is a change in the Radio button selection.

<div id="selectTerritories" />

<script>

$Lightning.use("c:DualingListBoxApp", function() {

$Lightning.createComponent("c:DualingListBox",

{

AvailableTerritoryOptionsTemp : optionsJSON,

AvailableTerritoryOptionsSelectedTemp : optionsSelectedJSON

},

"selectTerritories",

function(cmp) {}

});

});

</script>

I have tried to search google a lot but no luck, any help would be greatly appreciated.

Please note this is not a complete code, I have just pasted just a portions of it to demonstrate my 1 issue which I have explained above.

Thanks

Lovedeep
3 respostas
  1. 11 de mar. de 2019, 10:37
    Hi Lovedeep,

    So basically you need to rerender your lightning component whenever the value in radio button present on VF page is getting changed. You can try below approach:

    1) Use the oncomplete attribute of action support. In the method which gets called on the oncomplete event, make use of postMessage. Using postMessage, you can communicate from a VF page to lightning component.

    2) Handle the postMessage in your lightning component and in the postMessage, again call the init method of your lightning component.

    For information on postMessage, please refer this: https://developer.salesforce.com/blogs/developer-relations/2017/01/lightning-visualforce-communication.html

    Thanks,

    Ravi