Dropdown button not working on Datatable using yajra datatables laravel 8

Good day! I would like to ask question how to enable dropdown button on datatables? I added droptop to action column but only the button is showing, when clicked, nothing happens, no option being shown.

I am using yajra datatables plugin with ajax on getting data from the database.

$colleges = DB::table('pl_college');

return datatables($colleges->get())
->addColumn('c_code', function($row) {
return $row->c_code;
})
->addColumn('c_name', function($row) {
return $row->c_name;
})
->addColumn('c_dean', function($row) {
return $row->c_dean;
})
->addColumn('action', function($row) {
$action = ' <div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown button
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>';

return $action;
})

->rawColumns(['action'])
->make(true);

Text formatting options
Submit

Replies (1)

Hi,

Could you please try to add this to the datatable option?

->parameters([
'drawCallback' => 'function() { KTMenu.createInstances(); }',
])

Thanks

Text formatting options
Submit
Text formatting options
Submit