make column data as hyperlink (dataTable JQUERY)

Use columns.render API method to dynamically produce content for a cell.

$('#example').dataTable({
   "data": responseObj,
   "columns": [
      { "data": "information" }, 
      { 
         "data": "weblink",
         "render": function(data, type, row, meta){
            if(type === 'display'){
                data="<a href="" + data + '">' + data + '</a>';
            }

            return data;
         }
      } 
   ]
});

See this example for code and demonstration.

Leave a Comment