Is posbile to have 2 tables inside one livewire component?

I have done some tests, but it shows me the same data in both tables:
class ListResults extends Component implements HasForms, HasTable
{
use InteractsWithTable;
use InteractsWithForms;

public function table(Table $table): Table
{
$query = Results::query()
->...........
return $table
->.......
}

public function totalResultsTable(Table $table): Table
{
$query = Ranking::query()
->................
return $table
->.........
}

public function render()
{
return view('livewire.list-results', [
'ResultsTable' => $this->table(Tables\Table::make($this)),
'totalResultsTable' => $this->totalResultsTable(Tables\Table::make($this))
]);
}
class ListResults extends Component implements HasForms, HasTable
{
use InteractsWithTable;
use InteractsWithForms;

public function table(Table $table): Table
{
$query = Results::query()
->...........
return $table
->.......
}

public function totalResultsTable(Table $table): Table
{
$query = Ranking::query()
->................
return $table
->.........
}

public function render()
{
return view('livewire.list-results', [
'ResultsTable' => $this->table(Tables\Table::make($this)),
'totalResultsTable' => $this->totalResultsTable(Tables\Table::make($this))
]);
}
Blade
<div class="w-full">
{{ $stageResultsTable }}
</div>

<div class="w-full">
{{ $totalResultsTable }}
</div>
<div class="w-full">
{{ $stageResultsTable }}
</div>

<div class="w-full">
{{ $totalResultsTable }}
</div>
Thanks
1 Reply
LeandroFerreira
LeandroFerreira22h ago
I think they should be two LW components You can also use table widgets The widget is a LW component

Did you find this page helpful?