You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Something I'm missing currently on Filament is the ability to add custom content on different points of the resource pages. For example, I would like to add the ability to add a button to export the table to excel with a button near the 'Delete all' button.
I think this can be easily acomplished with few lines of code, this is what I'm doing now:
On my resource ListRecords page, I add a new property:
class ListProveedores extends ListRecords
{
/** * View to inject before the filters */publicstring$viewBeforeFilters = 'my.blade.view';
publicstatic$resource = ProveedorResource::class;
}
On list-records.blade.php (copied from vendor\filament\filament\resources\views\resources\pages\list-records.blade.php to resources\views\vendor\filament\resources\pages\list-records.blade.php for overloading):
<x-filament::app-contentclass="space-y-4">
<divclass="items-center justify-between space-y-4 sm:flex sm:space-y-0">
<div>
@if ($this->canDelete())
<x-tables::delete-selected:disabled="! $this->canDeleteSelected()" />
@endif
</div>
{{-- If we have something to show before the filters, inject here --}}@includeWhen($this->viewBeforeFilters, $this->viewBeforeFilters)
<x-tables::filter:table="$this->getTable()" />
</div>
So, you can create a new view, and put it on $viewBeforeFilters and it would be injected in that place, with access to the full Livewire component, properties and methods.
This can be extended to multiple places around the pages (as before and after header, footer, and so on), and also could be extended to allow to entirely change selected components on the page (for example you could use a custom filters component, or add more buttons to the actions header).
I would be able to add a PR for some starting points if this feature is something the maintainers would like to be added to Filament v1.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
Something I'm missing currently on Filament is the ability to add custom content on different points of the resource pages. For example, I would like to add the ability to add a button to export the table to excel with a button near the 'Delete all' button.
I think this can be easily acomplished with few lines of code, this is what I'm doing now:
ListRecords
page, I add a new property:list-records.blade.php
(copied fromvendor\filament\filament\resources\views\resources\pages\list-records.blade.php
toresources\views\vendor\filament\resources\pages\list-records.blade.php
for overloading):So, you can create a new view, and put it on
$viewBeforeFilters
and it would be injected in that place, with access to the full Livewire component, properties and methods.This can be extended to multiple places around the pages (as before and after header, footer, and so on), and also could be extended to allow to entirely change selected components on the page (for example you could use a custom filters component, or add more buttons to the actions header).
I would be able to add a PR for some starting points if this feature is something the maintainers would like to be added to Filament v1.
Beta Was this translation helpful? Give feedback.
All reactions