Storing Media in Data Grid

Hey there!

I’m developing an app where all reports are stored in PDF in a Data Table. My intention is that this media can be consulted by the user through a Data Grid in the form, so the download would be possible.

However, when I sync my Data Table with my Data Grid, the media column shows:
“<anvil.LazyMedia object>”

I’m struggling to turn this column “downloadable”. I’ve tried with the Link and Buttons components but I can’t access the pdf from the RowTemplate form.

You should not link the PDF directly to the Get Media column, as this is a text cell.

Instead, inside the row template of the data grid, you can add a button on the Get Media column. Said button can be coded to download the PDF related to each row.



Just solved it by:
def button_1_click(self, **event_args):
mymedia = self.item[‘get_media’]

so I can get the specific media of the row that the user is clicking.

Hey, Im having a similar issue to you, but im quite new to anvil, could you please show me the exact snippet of code you used to achieve this ?

Im trying to display files (PDFs) stored in the data tables

Welcome to the Forum!

This topic has already been marked as Solved (the checkbox in the title), so it probably won’t garner much attention. You may want to start a new topic of your own.