F
Filament6mo ago
lukevi

Column URL - apply only to text, not the whole cell?

My users are a bit thrown off that in an otherwise clickable row, the whitespace in a URL column follows the URL, rather than the row-click behavior. In their defense, mousing over the text creates an underline as if only the text is the link. Perhaps if mousing over the whitespace also triggered the underline, the current behavior would be more intuitive. Can anybody suggest how to accomplish either? Thanks in advance.
Solution:
You could create a custom column extending the TextColumn and customizing what you need https://filamentphp.com/docs/3.x/tables/columns/custom...
Jump to solution
4 Replies
LeandroFerreira
LeandroFerreira6mo ago
you could use a tooltip to show that it follows the url..
lukevi
lukeviOP6mo ago
good suggestion, thanks! That will show on hover anywhere in the cell & help make the expected click behavior fit what will happen. it's a little tempting to fiddle with the column component - it looks like I could remove the $url from these checks and make the overall cell keep the row's behavior.
#/vendor/filament/tables/resources/views/components/columns/column.blade.php
@if (($url || ($recordUrl && $action === null)) && (! $isClickDisabled))
<a
{{ \Filament\Support\generate_href_html($url ?: $recordUrl, $shouldOpenUrlInNewTab) }}
class="{{ $columnClasses }}"
>
{{ $slot }}
</a>
#/vendor/filament/tables/resources/views/components/columns/column.blade.php
@if (($url || ($recordUrl && $action === null)) && (! $isClickDisabled))
<a
{{ \Filament\Support\generate_href_html($url ?: $recordUrl, $shouldOpenUrlInNewTab) }}
class="{{ $columnClasses }}"
>
{{ $slot }}
</a>
then i'd have to go into the specific types like text-column.blade.php and put an <a> around maybe {{ $placeholder }}..
Solution
LeandroFerreira
LeandroFerreira6mo ago
You could create a custom column extending the TextColumn and customizing what you need https://filamentphp.com/docs/3.x/tables/columns/custom
lukevi
lukeviOP6mo ago
Amazing- Filament has still not stopped impressing me with its flexibility. Thank you for another very helpful answer.
Want results from more Discord servers?
Add your server