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