laravel-datatables: The exportOption 'columns' => ':visible' do not work
Summary of problem or feature request
When exporting, the param :
'exportOptions' => [
'columns' => ':visible
],
Do not work
it should enable the option to only export the visible columns and not all.
System details
- Operating System Debian wheezy
- PHP Version PHP 7.1.8
- Laravel Version Laravel Framework 5.5.19
- Laravel-Datatables Version
yajra/laravel-datatables-buttons v3.1.0 Laravel DataTables Buttons Plugin.
yajra/laravel-datatables-html v3.2.1 Laravel DataTables HTML builder plugin for Laravel 5.4+.
yajra/laravel-datatables-oracle v8.3.2 jQuery DataTables API for Laravel 4|5
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (5 by maintainers)
Indeed a workaround is to add a parameter to the function
_buildParams
And then cath it in the ‘getColumns’ method on server side. I just made a PR for that : https://github.com/yajra/laravel-datatables-buttons/pull/78In this POC, I did the changes for postExcel and postCsv But you can do the same for pdf and print and then adjust your code serverside. Cheers
It’s in the file changed in the PR : https://github.com/yajra/laravel-datatables-buttons/pull/78/files