Files in a table(grid) view

We use the grid view to show our clients various bits of information, including providing a link to reports that we create for them. It would be nice if we can set the column for files with either a default file name or display an icon instead of showing the full file name. By being able to display an icon in place of the name, it will provide a more uniform look.

1 Like

Agreed, this would be a handy addition natively. Long file names can cause the column to be wider than desired.
You may find the below video of use, it was inspired by a post on this forum a while ago. It’s a simple code based solution, it has to be simple as I’m not a coder :man_technologist:

//Change the File field to View link
$(document).on(‘knack-records-render.view_xxx’, function (event, scene, records) {
$(“#view_xxx”).find(“td.field_yyy”).each(function () {
if ($(this).text().trim() !== “”) {
$(this).find(“a”).text(“”);
$(this).find(“a”).append(“<i style="vertical-align: baseline !important;" class="fa fa-file-pdf-o"> View”);
}
});
});

Original thread :thread:

You may also find this thread by my college @StephenChapman helpful:

1 Like

Thanks Carl, while this is a great workable solution, the down side is the need to apply it to each page that has these types of links. Having a global setting would be great.

I will definitely try and make use of it until a better solution is created.

1 Like

I slightly modified it and used the column rules to display the font awesome icon. It removes the text-decoration on the &nbsp; and leaves a blank space in between the icon and the text.

Glad this was of some help. Stephen’s method is a global option. Nice adaption using a display rule to show a PDF icon instead :+1:
Hopefully one day this will be a native option @Kara

Please mark as solution if you’re happy :smiley: