On desktops, the event opens the SVG file preview player, which lets you preview images, documents, and other files in the browser. The file preview player supports full-screen presentation mode and provides quick access to file actions, such as upload, delete, download, and share.
On mobile devices, the file is downloaded. If the device supports file preview, the device’s preview app is opened.
This example opens a single file.
openSingleFile: function(cmp, event, helper) { $A.get('e.lightning:openFiles').fire({ recordIds: [component.get("v.currentContentDocumentId")] }); }
This example opens multiple files.
openMultipleFiles: function(cmp, event, helper) { $A.get('e.lightning:openFiles').fire({ recordIds: component.get("v.allContentDocumentIds"), selectedRecordId: component.get("v.currentContentDocumentId") }); }
Attribute Name | Type | Description |
---|---|---|
recordIds | String[] | Required. IDs of the records to open. |
selectedRecordId | String | ID of the first record to open from the list specified in recordIds. If a value isn’t provided or is incorrect, the first item in the list is used. |