I am working on some analytics and reporting data for a website that I manage. I am trying to create a link to download a CSV file after filtering data from a dataset.
I have the function that creates a CSV file from JSON data, but I am having trouble setting the download property for a button.
I have assigned the data URI to the button with the link prop, but now I need to pass a filename and file extension to the download property. The problem is that $w(“#button”).download is not a valid prop that can be set for a button element.
Does anyone have a workaround for this? Or know a different way of accomplishing something similar?
I have also tried to create a custom HTML element on the page and then pass the file name and uri to it via the postMessage method, but that was unsuccessful. Code below: