Table polling event/hook?

Hey, is there a event being emited or a Hook that we can attach some scripts when a table is polling? The idea is when a new order with status new is present in the table to trigger a audio player sound; How would that be implemented, I didnt found anything in the documentation in the Advanced Table section?
5 Replies
Dimitar
DimitarOP3d ago
Someone?
toeknee
toeknee3d ago
Event with polling I can't see how that would work. I think what you want to do is use notifications or a custom listner to trigger a notification and run a dispatch, and only show the listener to the people you want new orders to be sent too
Dimitar
DimitarOP3d ago
Event Or Render hook* When polling does filament go trough all the render hooks again, like that one? FilamentView::registerRenderHook( PanelsRenderHook::RESOURCE_PAGES_LIST_RECORDS_TABLE_BEFORE, fn (): string => view('my::hook-content'), );
toeknee
toeknee3d ago
I am not too sure tbh, you can test it. i think it'll call the render, but any JS assigned to the render won't be re-used as the dom wouldn't be re-mounted just filled.
Dimitar
DimitarOP2d ago
Its possible. Just find a renderhook that is very close to the table and add ->poll(15) to the table:
php FilamentView::registerRenderHook(
PanelsRenderHook::RESOURCE_PAGES_LIST_RECORDS_TABLE_BEFORE,
fn (): string => Blade::render(
<<<'blade'
@php session(['rerender' => (session('rerender') + 1)]); @endphp
<div>
RENDER BEFOER TABLEE {{ session('rerender') }}
</div>
blade
)
);
php FilamentView::registerRenderHook(
PanelsRenderHook::RESOURCE_PAGES_LIST_RECORDS_TABLE_BEFORE,
fn (): string => Blade::render(
<<<'blade'
@php session(['rerender' => (session('rerender') + 1)]); @endphp
<div>
RENDER BEFOER TABLEE {{ session('rerender') }}
</div>
blade
)
);
Then you can add another hook to the body to render some static html or js code;

Did you find this page helpful?