custom icon on row

custom icon on row

lieyongchanglieyongchang Posts: 29Questions: 2Answers: 0

I tried to insert a file icon on a specific row but it is not working. Below is my code

{"data": "message", "sortable": false,function(data, type, row){
    return '<i class="fa fa-file-o"></i><a href=/edit/' + row.id +'></a>'}
}

anyone encounter this issue before?

Answers

  • kthorngrenkthorngren Posts: 21,173Questions: 26Answers: 4,923

    Looks like you have the wrong syntax. You need to add the columns.render option, for example:

    {"data": "message", 
      "sortable": false,
      "render": function(data, type, row){
        return '<i class="fa fa-file-o"></i><a href=/edit/' + row.id +'></a>';
      }
    },
    

    Kevin

  • lieyongchanglieyongchang Posts: 29Questions: 2Answers: 0

    The icon is not apperring though..hmmm

  • lieyongchanglieyongchang Posts: 29Questions: 2Answers: 0

    i tried using css to scale and reposition it, but it did not work

  • kthorngrenkthorngren Posts: 21,173Questions: 26Answers: 4,923

    Did you download the fontawesome.css?

    Place your i tag somewhere else on the page to see if it displays.

    If you still have problems please post a link to your page or a test case showing the issue so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • lieyongchanglieyongchang Posts: 29Questions: 2Answers: 0

    I solve this by going to font awsome website and replace my current icon link with theirs and it appear. Thanks!

This discussion has been closed.