This is the table;
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Start date</th>
<th>Process</th>
</tr>
</thead>
</table>
and here is the javascript ;
$(document).ready(function () {
var table = $('#example').DataTable({
"sPaginationType": "full_numbers",
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "ServerSideProcessor.aspx",
"columnDefs": [{
"targets": -1,
"data": null,
"defaultContent": "<button type='button' class='btn btn-success'>PAY</button>"
}]
});
$('#example tbody').on('click', 'button', function () {
var data = table.row($(this).parents('tr')).data();
alert(data[1] + " is recieved.");
});
});
What I need is create different type of buttons in "Process" coloumb, for example ;
"columnDefs": [{
"targets": -1,
"data": null,
if(data[5]=='1')
"defaultContent": "<button type='button' class='btn btn-success'>PAY</button>"
else
"defaultContent": "<button type='button' class='btn btn-warning'>UNPAID</button>"
}]
});
How can I accomplish that ? Thank you