Can I defer-loading a table column/cell?

I need it because there's one column that fetches from an external API, individually. So waiting the whole table to load is not fun, right?
$table
->columns([
TextColumn::make('foo')
->getStateUsing(fn ($record) => SomeApiService::getDeviceStatus($record->device_key)),
])
$table
->columns([
TextColumn::make('foo')
->getStateUsing(fn ($record) => SomeApiService::getDeviceStatus($record->device_key)),
])
I expect that the table load normally, but that column will be 'loading' and show the result later.
4 Replies
wyChoong
wyChoong8mo ago
can the api handles your calls for 25 rows or more without throttling? the possible approach probably is to use livewire component as column. or use table action to fetch those records you need
IndomieRendang
IndomieRendang8mo ago
The api is strong enough to serve massive requests, but each may need few seconds for the response as it needs to fetch from connected device. So yeah it can be considered as throttling but it is the nature of that api. Outside the filament, I can make pool request to grab them concurrently, but not sure with livewire or filament table. Is it possible to merge the responses with the eloquent data before reaching the table? I couldn't find similar way like form->fill() or mutateDataXXX for filament table squint
wyChoong
wyChoong8mo ago
I think the best is use alpine x-init to call livewire function which call the api then display with x-data So your table can render without waiting the api Of course you should have some caching or something to avoid keep requesting the api
IndomieRendang
IndomieRendang8mo ago
Good idea, will try to explore it... Thanks for the idea and your time
Want results from more Discord servers?
Add your server
More Posts