Formatting document library view JSON

Occasional Contributor

I'm creating a simpel view for a document library, to show a description an a preview images.

In that view I need a download button to download the file.

ViewFormat.png

I can add the button and it will download the file IF it's not a known filetype eg. EPS, but if it's a known filetype linke JPG then it just opens the file in the browser.

 

Here is the JSON:

 "elmType": "button",
                  "style": {
                    "background-color": "#6eb556",
                    "color": "white",
                    "font-weight": "bold",
                    "font-size": "1rem",
                    "float": "right",
                    "margin-right": "150px"
                  },
                  "customRowAction": {
                    "action": "Download"
                  },
                  "txtContent": "Download",
                  "attributes": {
                    "class": "sp-row-button"

Is there any way to force it to always download?

0 Replies