Input Radiobutton
This example enables Radio Buttons in Table rows.
ID
|
Name
|
E-mail
|
|
---|---|---|---|
|
1
|
Test User
|
test@example.com
|
|
2
|
Luan
|
luanfreitasdev@fakemail.com
|
|
3
|
Daniel
|
dansysanalyst@fakemail.com
|
|
4
|
Claudio
|
claudio@fakemail.com
|
|
5
|
Vitor
|
vitao@fakemail.com
|
|
6
|
Tio Jobs
|
tiojobs@fakemail.com
|
Disclaimer: Table data is randomly generated for
illustrative purposes only. The information here is not a reflection of the actual market and does
not constitute business, financial, or medical advice.
<?php namespace App\Livewire\Examples\InputRadiobuttonTable; use App\Models\User;use Illuminate\Database\Eloquent\Builder;use Illuminate\Support\Carbon;use PowerComponents\LivewirePowerGrid\Column; use PowerComponents\LivewirePowerGrid\Facades\PowerGrid;use PowerComponents\LivewirePowerGrid\PowerGridComponent;use PowerComponents\LivewirePowerGrid\PowerGridFields; final class InputRadiobuttonTable extends PowerGridComponent{ public string $tableName = 'input-radio-button-table'; public function setUp(): array { $this->showRadioButton(); return [ PowerGrid::footer() ->showPerPage() ->showRecordCount(), ]; } public function datasource(): ?Builder { return User::query(); } public function fields(): PowerGridFields { return PowerGrid::fields() ->add('name') ->add('email') ->add('created_at_formatted', fn ($model) => Carbon::parse($model->created_at)->format('d/m/Y H:i:s')); } public function columns(): array { return [ Column::make('ID', 'id'), Column::make('Name', 'name') ->sortable() ->searchable(), Column::make('E-mail', 'email'), ]; }}
Code highlighting provided by Torchlight.dev