Strip HTML tags from CSV/ XLSX export #1199
KonstantinosVazaios
started this conversation in
Ideas
Replies: 2 comments
-
It would be great to exist as an option... |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hello! Can you send a Pr? I think stripTag could be a method in the Exportable::make()->stripTags() Class for example |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
⚡ PowerGrid ⚡ Feature Request ⚡HTML Strip Tags
Summary
The current CSV and XLSX export feature in Livewire Powergrid is missing a fundamental functionality – the ability to strip HTML tags from datatable rows during export. Although there is a sketchy way of not including HTML tags in the exported CSV/XLSX files, I have seen a lot of people complaining about the lack of a proper solution. I am referring to the solution where you need declare duplicates columns - the one for being displayed at the table and the other for the CSV/XLSX export only.
Why is this needed?
Implementing a proper HTML tag stripping feature in the CSV and XLSX export functionality of Livewire Powergrid is essential to provide users with a streamlined and efficient solution. While a workaround may exist, it often results in duplicate code and inefficiencies
Suggested Solution(s)
The method responsible for data transformation before CSV\XLSX export is 'prepare()' and it is located inside the power-components>livewire-powergrid>src>Services> Export.php class. As you will see in the attached file, I have marked with a red frame the code I have added in order to implement html tag stripping. I conditionally strip the html tags from the rows of the table by checking into the powergrid-livewire config file. Then I just map through the collection by using the laravel collection transform method and strip the html tags using the strip_tags($foo)
Beta Was this translation helpful? Give feedback.
All reactions