MedicOneSystems / MedicOneSystems/livewire-datatables
Cannot replace search highlight tags with exportCallback()
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 1.2k
- Forks
- 257
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to remove the markup that gets added to an exported field value when the search highlighting triggers. For example:
If I perform a search for Hoeger and export the results, my CSV cell data contains:
Hermann-<span class="bg-yellow-100">Hoeger</span>
So I try to perform a str_replace() on $value using the exportCallback() method like so: ( a more obvious example below )
->exportCallback(function ($value) {
Log::info($value);
$value = str_replace('span', 'moo', $value);
return $value;
}),
It just doesn't replace any part of the markup. The str_replace callback works on all other characters in the string, except the search highlight markup. What am I missing? Whats even more confusing is that I'm logging $value and the log file contains the vanilla value without any markup.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the exportCallback() path and the search-highlighting path, using the reported CSV value and logging behavior as the reproduction. Trace where the highlight markup is added relative to the callback, then verify that the callback can modify the complete exported value and that CSV output no longer contains the unwanted tags.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- laravel, php, tailwindcss
- Domain
- full-stack, search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100