Closed wturrell closed 2 years ago
Thanks @wturrell for the suggestions.
At first the ->hidden
method must hide the column in the web table and in the export. Maybe it's better to leave the hidden only in the Web part, it makes more sense
The only problem is that whenever it is hidden, visibleInExport (false)
must be set so that it does not appear
@luanfreitasdev @wturrell So we have a solution for this issue? issue closed but where is the solution?
The mentioned solution doesn't seem to work, if you want to improve it, please open a PR and express your point of view
@luanfreitasdev @wturrell So we have a solution for this issue? issue closed but where is the solution?
There's a simple reason for this, but I'm not totally confident how you fix it without breaking things for existing users…
As per the docs, I'm trying to get "a column to appear in the file but not at the web-page", by setting both hidden() and visibleInExport(true).
This doesn't work, because of the conditional below - it'll only include columns in the export which are ! hidden.
Solution?
In https://github.com/Power-Components/livewire-powergrid/blob/main/src/Services/Export.php#L54
you've got:
It feels like it ought to only check $column->visibleInExport, because 'hidden' shouldn't matter as this is the Export. Except if you do that, there will be a bunch of people with existing tables who've used hidden() by itself without knowing about / specifying visibleInExport, and suddenly they'll have a bunch of unwanted columns.
Maybe
if (! hidden && visibleInExport) || visibleInExport)
?If I were designing it from scratch I think I'd separate them: ->hiddenWeb() and ->hiddenExport(), but…
To Reproduce
Laravel 8.73.2
PHP 8.0 and 8.1
PowerGrid 1.5.0 (couldn't get it to work in 1.4.7 either)
Tailwind