DataTable Export Button issue

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

Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)

Hi Adivinar,

We did try your code, the dropdown seems working. Could you please check the console log if there is any JS error?

image

->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'],
],
],
])

Thanks

Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(