Skip to content

Commit 85229a7

Browse files
authored
Merge pull request #4521 from Laravel-Backpack/split-export-buttons
Split export buttons into two different configs - `showTableColumnPicker` and `showExportButton`
2 parents a3b0dd0 + cf1e494 commit 85229a7

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/app/Library/CrudPanel/Traits/Read.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,8 @@ public function enableExportButtons()
354354
}
355355

356356
$this->setOperationSetting('exportButtons', true);
357+
$this->setOperationSetting('showTableColumnPicker', true);
358+
$this->setOperationSetting('showExportButton', true);
357359
}
358360

359361
/**

src/resources/views/crud/inc/export_buttons.blade.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<script src="//cdn.datatables.net/buttons/1.5.6/js/buttons.colVis.min.js" type="text/javascript"></script>
1010
<script>
1111
window.crud.dataTableConfiguration.buttons = [
12+
@if($crud->get('list.showExportButton'))
1213
{
1314
extend: 'collection',
1415
text: '<i class="la la-download"></i> {{ trans('backpack::crud.export.export') }}',
@@ -91,15 +92,18 @@
9192
}
9293
}
9394
]
94-
},
95-
{
95+
}
96+
@endif
97+
@if($crud->get('list.showTableColumnPicker'))
98+
,{
9699
extend: 'colvis',
97100
text: '<i class="la la-eye-slash"></i> {{ trans('backpack::crud.export.column_visibility') }}',
98101
columns: function ( idx, data, node ) {
99102
return $(node).attr('data-visible-in-table') == 'false' && $(node).attr('data-can-be-visible-in-table') == 'true';
100103
},
101104
dropup: true
102105
}
106+
@endif
103107
];
104108
105109
// move the datatable buttons in the top-right corner and make them smaller

0 commit comments

Comments
 (0)