First of all, thank you very much for this great tool. When I try to set the button defaults through html builder, class applied to the buttons but not the buttons I choose to create are created but the certain set of them are. Below are the before/after secreen shots.


Thank you.
public function html()
{
return $this->builder()
->setTableId('users-table')
->columns($this->getColumns())
->minifiedAjax()
->dom("<'row'<'col-sm-12'B>><'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>")
->orderBy(1, 'asc')
->parameters([
'orderClasses' => false,
'pagingType' => 'first_last_numbers',
// Buttons default class
'buttons' => [
'dom' => [
'button' => [
'className' => 'btn btn-outline-primary',
]
]
]
])
->stripeClasses(['alert-info', 'alert-light'])
->buttons(
Button::make('create')->text('Olu艧tur'),
Button::make('export'),
Button::make('print'),
Button::make('reset'),
Button::make('reload')
);
}
@hgokturk hi did you solve you problem?
I just face this problem also. I just solve it by using this code
/**
* Optional method if you want to use html builder.
*
* @return \Yajra\DataTables\Html\Builder
*/
public function html()
{
return $this->builder()
->setTableId('users-table')
->columns($this->getColumns())
->minifiedAjax()
->orderBy(1)
->parameters([
'dom' => 'Bfrtip',
'buttons' => [
'buttons' => [
[
'extend' => 'create',
'text' => 'My Custom Name'
],
'print', 'excel'
],
'dom' => [
'button' => [
'className' => 'btn btn-light'
]
]
],
]);
}
which we need to config buttons in side parameters method. this work for me. I spend 3 days to figure out and fixed it.
Wow, I personally haven't tried that options as I usually set the defaults in javascript. Thanks for sharing your solution.
@Sok-Hai I wish I shared my solution before :)
public function html()
{
return $this->builder()
->setTableId('users-table')
->columns($this->getColumns())
->minifiedAjax()
->dom("<'row'<'col-sm-12 mb-4'B>><'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>")
->orderBy(1, 'asc')
//->paging(false)
->parameters([
'orderClasses' => false,
//'processing' => false,
'pagingType' => 'first_last_numbers',
'renderer' => [
'header' => 'bootstrap4',
'pageButton' => 'bootstrap',
],
// Buttons default class
'buttons' => [
'buttons' => [
[
'extend' => 'excel', 'text' => 'EXCEL'
],
[
'extend' => 'print', 'text' => 'PRINT'
],
[
'extend' => 'reload', 'text' => 'RELOAD'
],
[
'extend' => 'reset', 'text' => 'RESET'
],
],
'dom' => [
'button' => [
'className' => 'btn btn-outline-primary btn-sm',
]
]
]
])
->stripeClasses(['alert-info', 'alert-light']);
/*->buttons(
Button::raw([
'extend' => 'excel',
'text' => 'deneme'
]),
Button::make('create')->text('Olu艧tur'),
Button::make('export'),
Button::make('print'),
Button::make('reset'),
Button::make('reload')
);*/
}
This seems the way to do it.
@hgokturk next time if you found solution and fixed it. please post so i can save my 3 days. haha
@Sok-Hai I'm really sorry :)
@hgokturk yeah. so issue should be close now.
Most helpful comment
@hgokturk hi did you solve you problem?
I just face this problem also. I just solve it by using this code
which we need to config buttons in side parameters method. this work for me. I spend 3 days to figure out and fixed it.