You need to sign in to do that
Don't have an account?
Siva Sakthi
How to pass the parameters from VF Page into Lightning Component
Hi,
I am creating the lightning component with a leaflet map and access via Visualforce page. In that page created the drop down with contact list. Based on list value i select what are records set the Location ( Latitude and Longitude ) the map will refresh.
I have doubt how to pass the parameter of the list values into the lightning component. Guide me how to achieve this
This Error I got Using the 'Firing Lightning Events from Non-Lightning Code ' Method:
Uncaught SecurityError: Blocked a frame with origin "https://lightnapp-dev-ed--c.ap2.visual.force.com" from accessing a frame with origin "https://lightnapp-dev-ed.my.salesforce.com". Protocols, domains, and ports must match.
My Code:
==========
<apex:page showHeader="false" controller="ContactLocatorController">
<apex:includeLightning />
<div id="lightning" >
<script>
var myExternalEvent;
if(window.opener.$A && (myExternalEvent = window.opener.$A.get("e.c:ContactsSelected"))) {
myExternalEvent.setParams({});
myExternalEvent.fire();
}
var visualForceFunction = function(event) {
var EventData = event.getParam("contact");
console.log('::::::::::',EventData);
};
$Lightning.use("c:ContactLocatorApp", function() {
$Lightning.createComponent("c:ContactLocator",
{ },
"lightning",
function(cmp) {
$A.eventService.addHandler({ "event": "c:ContactsSelected", "handler" : visualForceFunction});
//alert('handler test');
});
});
</script>
<apex:form >
<apex:outputText label="You Have Selected : " value="{!selectedContact}"/>
<apex:selectList size="1" value="{!selectedContact}">
<apex:selectOptions value="{!ContactsList}" />
<!-- <apex:actionSupport event="onchange" oncomplete="function(this)"/>-->
</apex:selectList><br/>
</apex:form> </div>
</apex:page>
Advance Thanks
I am creating the lightning component with a leaflet map and access via Visualforce page. In that page created the drop down with contact list. Based on list value i select what are records set the Location ( Latitude and Longitude ) the map will refresh.
I have doubt how to pass the parameter of the list values into the lightning component. Guide me how to achieve this
This Error I got Using the 'Firing Lightning Events from Non-Lightning Code ' Method:
Uncaught SecurityError: Blocked a frame with origin "https://lightnapp-dev-ed--c.ap2.visual.force.com" from accessing a frame with origin "https://lightnapp-dev-ed.my.salesforce.com". Protocols, domains, and ports must match.
My Code:
==========
<apex:page showHeader="false" controller="ContactLocatorController">
<apex:includeLightning />
<div id="lightning" >
<script>
var myExternalEvent;
if(window.opener.$A && (myExternalEvent = window.opener.$A.get("e.c:ContactsSelected"))) {
myExternalEvent.setParams({});
myExternalEvent.fire();
}
var visualForceFunction = function(event) {
var EventData = event.getParam("contact");
console.log('::::::::::',EventData);
};
$Lightning.use("c:ContactLocatorApp", function() {
$Lightning.createComponent("c:ContactLocator",
{ },
"lightning",
function(cmp) {
$A.eventService.addHandler({ "event": "c:ContactsSelected", "handler" : visualForceFunction});
//alert('handler test');
});
});
</script>
<apex:form >
<apex:outputText label="You Have Selected : " value="{!selectedContact}"/>
<apex:selectList size="1" value="{!selectedContact}">
<apex:selectOptions value="{!ContactsList}" />
<!-- <apex:actionSupport event="onchange" oncomplete="function(this)"/>-->
</apex:selectList><br/>
</apex:form> </div>
</apex:page>
Advance Thanks
<apex:form >
<apex:outputText label="You Have Selected : " value="{!selectedContact}"/>
<apex:selectList size="1" value="{!selectedContact}" onchange="getRemoteAccount();">
<apex:selectOptions value="{!ContactsList}" id="contactSelect" />
</apex:selectList><br/>
</apex:form>
<script>
function getRemoteAccount() {
//Adding Lightning Component Here
$Lightning.use("c:ContactLocatorApp", function() {
$Lightning.createComponent("c:ContactLocator",
{contact:"contact"}, //------> Here i have passed the selected contact via value change.
"lightning",
function(cmp) {
// any further setup goes here
});
});
}
</script>
Thanks