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
Solution:
I think they should be two LW components You can also use table widgets The widget is a LW component...
Jump to solution
2 Replies
Solution
LeandroFerreira
LeandroFerreira2mo ago
I think they should be two LW components You can also use table widgets The widget is a LW component
H.Bilbao
H.BilbaoOP2mo ago
ok, thanks @Leandro Ferreira I will try with 2 LW components

Did you find this page helpful?