HTML element in datatables columns
HTML element in datatables columns
lmhaydi
Posts: 1Questions: 1Answers: 0
I use an ajax search form, i show the result in datatables but i want to write a HTML element into a column like
<a href="#" class="paycash-link">my link</a>
What i do :
$('#reservation_response').dataTable( {
data : data,
columns : [
{data : 'token_id'},
{data : 'create_at'},
{data : 'customer_billing_amount'},
{data : 'customer_name_surname'},
{data : 'pos.pos_name'},
{data : 'acquirer.acquirer_name'},
{data : 'provider.provider_name'},
{data : 'resa_status'},
{data : }
],
dom: 'T<"clear">lfrtip',
tableTools: {
"sSwfPath": "http://cdn.datatables.net/tabletools/2.2.2/swf/copy_csv_xls_pdf.swf"
},
pagingType: "simple_numbers",
language: {
"url": "//cdn.datatables.net/plug-ins/a5734b29083/i18n/French.json"
}
} );
And at the last column (line 12) i want to write a HTML element, how can i dot it ?
This discussion has been closed.
Answers
I think something like
"columns": [
{"render": function ( data) {
return '<your html + data + more html>';
}},
I'm not on my work computer so I'm not 100% sure that this is correct.
Yup, like @Woldere says, use
columns.render
. There is an example of the docs page for it on how to create a link tag (basically what @Woldere said!).Allan