I want send to the table some HTML tags like
I use editColumn to add some HTML code to this column
its work with addColumn but not with editColumn
the question is how I can send HTML elements to table from controller the example above show the HTML tags when I need to view label
public function CustomerTicketAjax(Request $request, $id)
{
if ($request->ajax()) {
$tickets = Customer::find($id);
return Datatables::of(CustomerTicket::with('user')->where('customer_id', $tickets->id))
->editColumn('status', function ($tickets) {
if ($tickets->status == 1) {
return '<span class="label bg-red" style="font-size: 21px;">open</span>';
} elseif ($tickets->status == 0) {
return '<span class="label bg-red" style="font-size: 21px;">close</span>';
};
})
->make(true);
}
}
You need to specify which columns contains html using ->rawColumns(['status]).
Most helpful comment
You need to specify which columns contains html using
->rawColumns(['status]).