1$(document).ready( function () {
2 var table = $('#example').DataTable({
3 columnDefs: [{targets: [0, 1, 2, 3, 4, 5],
4 render: function ( data, type, row ) {
5 var color = 'green';
6 if (data == "example") {
7 color = 'green';
8 }
9 if (data > 10) {
10 color = 'blue';
11 }
12 if (data < 60) {
13 color = 'red';
14 }
15 return '<span style="color:' + color + '">' + data + '</span>';
16 }
17 }]
18 });
19} );
1$(document).ready( function () {
2 var table = $('#example_table').DataTable({
3 columns: [
4 {
5 data: "example_data",
6 render: function (data) {
7 if (data == true) {
8 return '<h5><span class="badge badge-success">Example</span></h5>';
9 } else {
10 return '<h5><span class="badge badge-danger">Another Example</span></h5>';
11 }
12 },
13 },
14 ]
15 });
16} );