It depends where you want to apply your custom css class.
CSS class for table row
If you want to add the custom class to the <tr>
element, I recommend to overwrite the function single_row
like so:
public function single_row( $item ) {
$cssClass = ($item['view_status '] == 1) ? 'make-it-green' : 'make-it-grey';
echo '<tr class="'.$cssClass.'">';
$this->single_row_columns( $item );
echo '</tr>';
}
CSS class for table cell
Use the column_{column name}
functions like you have outlined it with column_default
and put a HTML tag as a wrapper within the cell. For example a span
element:
public function column_default( $item, $column_name ) {
$cssClass = ($item['view_status '] == 1) ? 'make-it-green' : 'make-it-grey';
switch ( $column_name ) {
case 'id':
return '<span class="'.$cssClass.'">'.$item[$column_name].'</span>';
default:
return $item[$column_name];
}
}