I used the log/audit page example to create a new page and the datatable shows up fine, but I can not get the export buttons to show.
public function html(): HtmlBuilder
{
return $this->builder()
->setTableId("users-table")
->columns($this->getColumns())
->minifiedAjax()
->stateSave(true)
->orderBy(6)
->responsive()
->autoWidth(false)
->parameters([
"buttons" => ["export"],
])
->buttons([
Button::make("create"),
Button::make("export"),
Button::make("print"),
Button::make("reset"),
]);
}
Hi,
To resolve the issue, you need to modify the DOM configuration in the file located at resources/assets/extended/js/vendors/plugins/datatables.init.js. You need to add "B" to the existing DOM configuration. Here's an example:
dom:
"Bf<"table-responsive"tr>" +
//...
I tried your change and yes the error goes away, but there are no buttons that show in the datatable. I have used yajrabox datatables before and the buttons show like they should. its something about this theme that is not working. The examples on the theme dont add buttons, so im not sure whats missing.
Hi,
It seems that the error "Uncaught Cannot extend unknown button type: create" is related to the button type 'create' which is not recognized by the DataTables Buttons extension. To resolve this issue, you can remove the 'create' button type from your buttons list and keep only the export, print, and reset buttons.
You can modify your code like this:
public function html(): HtmlBuilder
{
return $this->builder()
->setTableId("users-table")
->columns($this->getColumns())
->minifiedAjax()
->stateSave(true)
->orderBy(6)
->responsive()
->autoWidth(false)
->buttons([
Button::make("export"),
Button::make("print"),
Button::make("reset"),
])
->parameters([
"buttons" => ["export", "print", "reset"],
]);
}