0

I'm using the <lightning:checkboxGroup /> aura component to display a list of files that can be selected and then deleted. All of this works fine. My question is if it is possible to make the name of each file (label) that is displayed into a hyperlink without having to re-tool the entire component. The requirement is to make the file name a hyperlink so the user can click to open it and verify it is the correct file before selecting it (marking the checkbox) and then deleting. I don't see any option to make that a hyperlink. Or, is there another option?

<aura:attribute name="recordId" type="String" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:attribute name="selectedFiles" type="List" />
<aura:attribute name="fileList" type="List" />
<aura:attribute name="noFiles" type="Boolean" />
<aura:attribute name="showConfirmDialog" type="boolean" default="false"/>

<aura:if isTrue="{!v.noFiles}">
    <lightning:card title="There are currently no Files related to this record." />
    <aura:set attribute="else">
        <lightning:card title="Delete Files">
            <div class="slds-m-left_small">
                <lightning:checkboxGroup aura:id="checkbox"
                                        name="Checkbox Group"
                                        options="{!v.fileList}"
                                        value="{!v.selectedFiles}"/>
                <lightning:button type="submit" name="delete" label="Delete Selected Files" class="slds-button_brand" onclick='{!c.onSubmit}'/>
            </div>
        </lightning:card>
    </aura:set>
</aura:if>

<aura:if isTrue="{!v.showConfirmDialog}">
        <!--Modal Box Start-->
        <div role="dialog" class="slds-modal slds-fade-in-open ">
            <div class="slds-modal__container">
                <!--Modal Box Header Start-->
                <header class="slds-modal__header">
                    <h1 class="slds-text-heading--medium">Confirmation</h1>
                </header>
                <!--Modal Box Header End-->
                 
                <!--Modal Box Content Start-->
                <div class="slds-modal__content slds-p-around--medium">
                    <center><b>This action will delete the selected file. Please continue or cancel below.</b></center>
                </div>
                <!--Modal Box Content End-->
                 
                <!--Modal Box Button Start-->
                <footer class="slds-modal__footer">
                    <lightning:button name='No' label='Cancel' onclick='{!c.handleConfirmDialogNo}'/>
                    <lightning:button variant="brand" name='Yes' label='Continue' onclick='{!c.handleConfirmDialogYes}'/>
                </footer>
                <!--Modal Box Button End-->
            </div>
        </div>
        <div class="slds-backdrop slds-backdrop--open"></div>            
    </aura:if>

1 Answer 1

0

No, you can't make hyperlinks in that component. How about using a lightning-datatable, which gives you the ability to select rows and have hyperlinks?

1
  • Hi @sfdcfox I was afraid I'd have to re-tool the component. Thanks for clarifying! I'll switch to using a lightning-datatable as you suggested.
    – Dman100
    Commented Jun 1, 2021 at 20:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .