This is how i fill my column using a normal html table which works fine
<td>
<span class="status">
@if ($try->status == 0)
<span style="font-size:15px" class="label label-success">Fresh</span>
@elseif ($try->status == 1)
<span style="font-size:15px" class="label label-danger">Stale</span>
@else
<span style="font-size:15px" class="label label-warning">Docked</span>
@endif
</span>
</td>
but now, i want to use a datatables for this and this is how i am doing it but it doesn't work. The column only appears blank although the response is returned from the database.
->addColumn('customer', function ($category) {
return '<p>'.$category->customers->name.'</p>';
->addColumn('status', function ($category) {
'<p>
@if ($category->status == 0)
<span style="font-size:15px" class="label label-
success">Fresh</span>
@elseif ($category->status == 1)
<span style="font-size:15px" class="label label-
danger">Stale</span>
@else
<span style="font-size:15px" class="label label-
warning">Docked</span>
<p>';
})->make(true);
PS: Customer's name appears in the customer column in the datatables but for status column, it is empty. Why is this happening with datatables? Could it be my syntax?
addColumnoptions in datatablesaddColumn for customersworks fine and not thestatusaddColumn.