Skip to content

Render PowerGrid Tables โ€‹

PowerGrid tables are Livewire components. Render them in a Blade view or from a route.

Blade View โ€‹

HTML Tag โ€‹

For app/Livewire/ProductTable.php:

phpresources/views/my-view.blade.php
<livewire:product-table />

Blade Directive โ€‹

phpresources/views/my-view.blade.php
@livewire('product-table')

Component in sub-folder โ€‹

For app/Livewire/Tables/ProductTable.php:

phpresources/views/my-view.blade.php
<livewire:tables.product-table />

Routes File โ€‹

phproutes/web.php
Route::get('/product', ProductTable::class)->name('product-table');

Multiple Tables per page โ€‹

Give each table a unique $tableName. See Table Reference Name.

If pagination is on, set a distinct ?page= name per table. See URL Page Parameter.

phpresources/views/my-view.blade.php
<livewire:product-table />

<livewire:user-table />

Component Attributes โ€‹

Passing Attributes โ€‹

tableName is a public property on the component:

phpresources/views/my-view.blade.php
<livewire:product-table tableName="ProductTable" />

<livewire:user-table tableName="UserTable" />

$tableName cannot be empty or default.

Passing Custom Attributes โ€‹

Declare a matching public property on the table:

phpapp/Livewire/ProductTable.php
class ProductTable extends PowerGridComponent
{
    public string $currency;
}
phpresources/views/my-view.blade.php
<livewire:product-table currency="USD" />

Defer Loading โ€‹

See Defer Loading.

Created By Luan Freitas and @DanSysAnalyst