Download link

I have successfully added the below to a datagrid column in the template property and this works great.

<a [href]="data.DocumentFile | safe" download="DocumentFile.${getExtension(data.DocumentFile)}">download</a>

Along with adding the Page Property of getExtension
value: (dataURI) => {return dataURI.substring(dataURI.indexOf('/') + 1, dataURI.indexOf(';base64'));}

The file or image gets uploaded to the database and the download link does download them in the browser.
The trouble I'm having is that if the record is null (meaning they didn't upload a file) the datagrid stops loading the records. I've tried the below with no success but my coding is not the best. Can anyone point me to a document that will help.

In the column template I selected the "Open popup code editor" and tried:

  1. if (data.DocumentFile != null)
    {
    <a [href]="data.DocumentFile | safe" download="DocumentFile.${getExtension(data.DocumentFile)}">download
    }

  2. if ((!data.DocumentFile.Equals(null))
    

    {
    <a [href]="data.DocumentFile | safe" download="DocumentFile.${getExtension(data.DocumentFile)}">download
    }
    I've tried a few others that were similar, none worked.

Thanks

Thanks to all that looked at my question.

I found the answer in the conditional formatting video/tutorial.

<span *ngIf="data.DocumentFile != null">
<a [href]="data.DocumentFile | safe" download="DocumentFile.${getExtension(data.DocumentFile)}">download