How to display local image in cell

How to display local image in cell

tdevoe@acord.orgtdevoe@acord.org Posts: 21Questions: 8Answers: 2

I have read a # of entries regarding pulling and displaying an image from a database. I am looking for a simple example of displaying an image that is in the local folder. Below is an example of what I have tried without success. I read about Render but don't feel that this is required since it is a local image, not pulled from the database and their is no logic necessary for deciding what image to display. The image would be the same for all rows.

                    "columns": [
                        {"render": function (data, type, full, meta) {
                            return '<img src="Content/css/images/sort_asc.png>';}
                        },
                        {"image": '<img src="Content/css/images/sort_asc.png>'},
                        { '<img src="Content/css/images/sort_asc.png>"' },
                        { "data": "MatrixName" },
                        { "data": "CodeValueAbbreviation" },
                        { "data": "StandardAbbreviation" },
                        { "data": "ElementBusinessTerm" },
                        { "data": "StatusCode" },
                        { "data": "UsageNotes" }
                    ],

Thanks for your help.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    You will need to use columns.render. What data property name is the information about the image in?

    Allan

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    The image would be the same for all rows.

    Sorry. I missed that part originally. If it is static and not row dependent - use columns.defaultContent and just set it to be an image tag. Use data: null to tell DataTables don't to try and read any data.

    Allan

This discussion has been closed.