Media Objects in Data Grids

Hi,
Im quite new to Anvil and I am trying to get files (PDFs) to show (and be downloadable) in Data Grids

Currently its showing up as this:


,

Is there any way to have the PDFs in the “files” column be clickable for download?

This is how im populating the Data Grid:

Client code:
self.repeating_panel_1.items = anvil.server.call('getAdminPDFs')

Server Code:

@anvil.server.callable
def getAdminPDFs():
  if anvil.users.get_user() is not None:
    return app_tables.admin.search()

Thanks

The workflow is typically something like:

  1. Edit the Row Template.
  2. Put a button object or link object in the column you would like to represent the files.
  3. Have the click event of this object (the code in the row template will generate for you when you double click the object in the ide, from inside the row template) use the anvil.media.download(self.item['the_name_of_the_column_from_your_data_table']) method found below to trigger the file to be downloaded to the users browser, from that specific row.
3 Likes

Thank you so much!!!