Skip to content

Auto-Refresh โ€‹

There is no PowerGrid::autoRefresh() helper. Poll a parent component and dispatch pg:eventRefresh-{tableName}. The table must have a unique $tableName.

Enabling Auto-Refresh โ€‹

Use Livewire wire:poll to dispatch the event on an interval. See Events.

php
use PowerComponents\LivewirePowerGrid\PowerGridComponent;

class ProductTable extends PowerGridComponent
{
    public string $tableName = 'ProductTable'; 
}
php
namespace App\Livewire;

use Livewire\Component;

class TableRefresher extends Component
{
    public function refreshTable() 
    {
        $this->dispatch('pg:eventRefresh-ProductTable');
    }

    public function render()
    {
        return view('livewire.table-refresher');
    }
}
php
<div wire:poll.30s="refreshTable">
    <livewire:product-table />
</div>
php
<livewire:table-refresher />

Created By Luan Freitas and @DanSysAnalyst