Use font awesome icon returned from server in a table cell

Use font awesome icon returned from server in a table cell

kpgracikpgraci Posts: 4Questions: 2Answers: 1

I've looked around the excellent documentation (thanks for that) and have one remaining question...

In my server-side column data I return column data like "fa-file-o" and I want that to render in the tables as <i class="fa fa-file-o>,/i>"

Is there a way to do this?

This question has an accepted answers - jump to answer

Answers

  • kpgracikpgraci Posts: 4Questions: 2Answers: 1
    edited September 2017 Answer ✓

    OK, I answered my own questions, here it is:

            columns: [
                { "data": "Icon",
                  "orderable": false,
                  "render": function (data, type, row) { return "<i class='fa " + data + "'></i>" } 
                 },
                { "data": "CreatedOn", "orderSequence": [ "desc", "asc" ] },
                { "data": "Description", "orderable": false  }
            ]
    

    So how do I mark this as answered?

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

    Currently the forum doesn't let you mark your own replies as the answer (I need to get around to changing that). I've marked your reply as the answer for now though.

    Allan

This discussion has been closed.