How can I show an image in a cell instead of the data string, IF there is data.

How can I show an image in a cell instead of the data string, IF there is data.

SkrockiSkrocki Posts: 21Questions: 9Answers: 0

I've found other questions with answers to describe how to get an image in a cell. However, I want to show an image only if the cell has data. For example, I do home inspections and sometimes there are special notes about the inspection (ie. who I am to meet, gate code, etc.). The notes themselves will take up too much space in my table, so I just want to show an image to indicate there is a note, then hover over the image and the note shows itself as a tooltip or title. I've accomplished this in my self-programmed table I have used for years with a simple IF statement checking the database results for each row, but with no real access to the <td> in datatables I'm not sure how to accomplish this. I didn't provide a link because there is no reason to, it would just be a link to my datatable which is standard programming out of the box.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974
    Answer ✓

    Use columns.render for this. See this example.

    Kevin

  • SkrockiSkrocki Posts: 21Questions: 9Answers: 0

    Thank you so much Kevin! I'm sorry I didn't find those instructions on my own, I was looking pretty vigilantly. Thank you for taking your time to reply! Have a great night!

    Steve

Sign In or Register to comment.