2

I created a component in LWC which uses standard Salesforce file preview. It is perfectly working on desktop but nothing happens when I press file name on mobile version. My html code is below:

    <template for:each={files} for:item="file">        
       <span class="slds-truncate">
          <a data-id={file.itemId} onclick={navigateToFiles}>
             {file.name}
          </a>
       </span>
    </template>

And js controller:

    import { LightningElement, api, track, wire } from 'lwc';
    import { NavigationMixin } from 'lightning/navigation';        

    export default class LwcAdmKnowledgeBaseFolderDetails extends NavigationMixin(LightningElement) {
       navigateToFiles(event) {
          this[NavigationMixin.Navigate]({
             type: 'standard__namedPage',
             attributes: {
                pageName: 'filePreview'
             },
             state: {
                recordIds: event.currentTarget.dataset.id
             }
          })
       }
    }

I think this is an issue with LWC because standard Salesforce file preview with the use of lightning:openFiles event works on mobile in my Aura components. Any resolution of this problem?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.