I have a table in a Laravel application and on the basis of a cell content I want to change the colour of the row.
Part of my datatables javascript is
ajax:"",
columns: [
{ data: 'address', name: 'address' },
{data: 'town', name: 'town'},
{data: 'postcode', name: 'postcode'},
{data: 'units',name: 'units'},
{ data: 'examination', name: 'examination' },
{data: 'priority', name:'priority', searchable: false},
{data: 'completed', name:'completed'},
{data: 'action', name: 'action', orderable: false, searchable: false},
],
"createdRow": function( row, data, index ) {
if ( data[6] == "1" )
{
$(row).addClass( 'redRow' );
}
},
The priority field is either 1 or 0.
The table works but the background colour is always white.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire