Add array of filename as hyperlink in datatable jquery -


i have following datatable:

     $('#mydt').datatable( {         "columndefs": [{             "defaultcontent": "-",             "targets": "_all"         }],          data: apparray,         "aocolumns": [             { "mdata": "name" },             { "mdata": "age" }         ]     } ); 

html:

<table id="mydt">        <thead>         <tr>         <th>name</th>         <th>age</th>         <th>mypics</th>         </tr>     </thead> </table> 

now apparray array contains collection of files here structure:

[ {age: "29" ,files: {file1: 1505050304702, file2: 1505050304701}, name: "newuser1"}, {age: "22" ,files: {file1: 1505050304731, file2: 1505050304739}, name: "newuser2"} ] 

i need display file names hyperlink in above datatable along other data name , age etc. files single record should in same cell. how can same?

you can use render callback. see datatable.js columns.render

as example use:

render: function ( data, type, row, meta ) {   return '<a href="'+row.files.file1+'">file 1</a>' +     '<a href="'+row.files.file2+'">file 2</a>'; } 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -