F
Filament2mo ago
Patie

Records count in table header

Hi, its possible to have current records count (init, but also after filtering or searching) in table header? I tried multiple ways, but without luck yet.
Solution:
looks like its working with: ``` public function updated() {...
Jump to solution
2 Replies
Solution
Patie
Patie2mo ago
looks like its working with:
public function updated()
{
$this->total = $this->getFilteredTableQuery()->count();
$this->getTable()->header($this->getTableHeader());
}

public function rendering()
{
$this->total = $this->getFilteredTableQuery()->count();
$this->getTable()->header($this->getTableHeader());
}

protected function getTableHeader(): ?View
{
if ($this->total > 0) {
return view('components.banner', ['message' => $this->total, 'style' => 'warning']);
}
return null;
}
public function updated()
{
$this->total = $this->getFilteredTableQuery()->count();
$this->getTable()->header($this->getTableHeader());
}

public function rendering()
{
$this->total = $this->getFilteredTableQuery()->count();
$this->getTable()->header($this->getTableHeader());
}

protected function getTableHeader(): ?View
{
if ($this->total > 0) {
return view('components.banner', ['message' => $this->total, 'style' => 'warning']);
}
return null;
}
its correct way how to do it?
Patie
Patie2mo ago
meh.. its working with search, but not with filters for some reason 😦 ok it was my fault, view was blade component, not livewire component, now its working
Want results from more Discord servers?
Add your server