make column data as hyperlink (dataTable JQUERY)

后端 未结 3 422
终归单人心
终归单人心 2020-12-08 07:20

I am trying to make a column as hyperlink with datatable but no success.

function successCallback(responseObj){

  $(document).ready(function() {
             


        
3条回答
  •  时光取名叫无心
    2020-12-08 07:47

    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 = '' + data + '';
                }
    
                return data;
             }
          } 
       ]
    });
    

    See this example for code and demonstration.

提交回复
热议问题