When exporting, the param :
'exportOptions' => [
'columns' => ':visible
],
Do not work
it should enable the option to only export the visible columns and not all.
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
Can you please link me to the datatables.net example of how this is done? This option is a bit new to me. Thanks!
I see, this demo is for printing on client-side implementation. For server-side, unfortunately it's not supported.
@yajra do you think this feature will be implemented in a future version?
It is a bit weird that the printing on the server side takes into account the visibility of the columns, but the xls exporting does not. Is there a reason for the different behavior?
AFAIK, colvis is not also available on server-side implementation on the JS side so it might a bit difficult to implement atm.
For exporting, you can just set exportable
to false. Here are some column config the you can use:
'orderable' => false,
'searchable' => false,
'exportable' => false,
'printable' => true,
'visible' => true,
Any work around this issue or feature yet?
@yajra I think we might pass a variable to _buildParams I'm not sure how to do that yet, but I request you might give me a hint :)
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/78
Well, now we know how to catch the parameter on the server side, aka backend, but how to send it in the actual dt ajax request? what js we need to edit?
It's in the file changed in the PR :
https://github.com/yajra/laravel-datatables-buttons/pull/78/files
Doesn't work with print! @FabienLucini, only with postcsv visible. not even pdf!
In 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
@FabienLucini Thank you very much, you really did the trick. You saved me hours of thinking and brain storming.
Sometimes, maybe all the time :D one feels dump, the solution is in front of your eyes, and you can't figure it out. loooool
@yajra Let's implement these changes to the branch.
@FabienLucini @AmirTallap thanks. You can also PR the print part for a hacktobefest
points in case you are joining the treat.
Most helpful comment
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/78