My DataTable service code here
Public function html()
{
return $this->builder()
->setTableId('admin-countries-table')
->columns($this->getColumns())
->columns($this->getColumns())
->addColumnBefore([
'defaultContent' => '',
'data' => 'DT_RowIndex',
'name' => 'DT_RowIndex',
'title' => '#',
'render' => null,
'orderable' => false,
'searchable' => false,
'exportable' => false,
'printable' => true,
'footer' => '',
])
->minifiedAjax()
->stateSave(true)
->responsive()
->autoWidth(false)
->parameters([
'scrollX' => true,
'drawCallback' => 'function() { KTMenu.createInstances(); }',
'dom' => 'lBfrtip',
'buttons' => [
[ 'text' =>' Add User', 'className' => 'btn-primary', 'init'=>'function(){removeClass(this)}','action'=>'function(){alert(1)}'] ,
['extend'=>'collection', 'text'=>'Export' ,'className' => 'btn-primary' ,'init'=>'function(){removeClass(this)}',
'buttons'=>['copy','excel','csv','pdf','print']
]
],
])
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
}
NB : Please refer the below link for screenshot
https://prnt.sc/SfTqdjusAB_Z
Hi Adivinar,
We did try your code, the dropdown seems working. Could you please check the console log if there is any JS error?
<img src="https://i.ibb.co/8XYRwbs/image.png" alt="image" border="0">
->parameters([
"scrollX" => true,
"drawCallback" => "function() { KTMenu.createInstances(); }",
"dom" => "lBfrtip",
"buttons" => [
["text" => " Add User", "className" => "btn-primary", "init" => "function(){}", "action" => "function(){alert(1)}"],
[
"extend" => "collection", "text" => "Export", "className" => "btn-primary", "init" => "function(){}",
"buttons" => ["copy", "excel", "csv", "pdf", "print"],
],
],
])