Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <apex:page standardController="Opportunity" extensions="LightningOutDemoCtrl">
- <apex:includeLightning />
- <div id="CardContainer" >
- </div>
- <script>
- var Id = '{!$CurrentPage.parameters.Id}';
- console.log(Id);
- $Lightning.use("c:LightningComponentFromVFApp", function() {
- $Lightning.createComponent("c:NewFileUpload",
- {
- recordId : Id
- },
- "CardContainer",
- function(cmp) {
- console.log('Component created');
- });
- });
- </script>
- public class LightningOutDemoCtrl {
- public Id recordId{get;set;}
- public LightningOutDemoCtrl(ApexPages.StandardController stdcontroller){
- recordId = ApexPages.currentPage().getParameters().get('id');
- System.debug('Record Id is: '+recordId);
- }
- }
- <aura:application access="GLOBAL" extends="ltng:outApp">
- <aura:dependency resource="c:NewFileUpload"/>
- </aura:application>
- <aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
- This is New File Upload component.
- {!v.recordId}
- <aura:attribute name="recordId" type="Id"/>
- <lightning:fileUpload label="Upload File" multiple="true" recordId="{!v.recordId}" aura:id="multifileUpload" onuploadfinished="{!c.handleUploadFinished}" />
- </aura:component>
- ({
- handleUploadFinished: function (cmp, event) {
- //Get the list of uploaded files
- debugger;
- var uploadedFiles = event.getParam("files");
- //Show success message – with no of files uploaded
- var toastEvent = $A.get("e.force:showToast");
- toastEvent.setParams({
- "title": "Success!",
- "type" : "success",
- "message": uploadedFiles.length+" files uploaded successfully!"
- });
- toastEvent.fire();
- $A.get('e.force:refreshView').fire();
- //Close the action panel
- var dismissActionPanel = $A.get("e.force:closeQuickAction");
- dismissActionPanel.fire();
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement