So I was playing around with symfony/ux-live-components and modified a page with a pagerfanta grid to display some infos.
the only changs needed was to overwrite the template for the links.
but unfortunatly the pager block doesnt have the page variable set in next/previous links.
it would not hurt to have them in.
#[AsLiveComponent('candidates')]
class CandidatesComponent
{
use DefaultActionTrait;
#[LiveProp(writable: true)]
public int $page = 1;
#[LiveProp()]
public ?Pagerfanta $pagerfanta = null;
public function getCandidates(): Collection|iterable
{
$queryBuilder = $this->getCandidatesQueryBuilder();
$this->pagerfanta = new Pagerfanta(new QueryAdapter($queryBuilder));
$this->pagerfanta->setCurrentPage($this->page);
return $this->pagerfanta->getCurrentPageResults();
}
}
<table>
{% for candidate in this.candidates %}
// print data
{% endfor %}
</table>
{{ pagerfanta(this.pagerfanta, {'omitFirstPage': true }) }}
So I was playing around with symfony/ux-live-components and modified a page with a pagerfanta grid to display some infos.
the only changs needed was to overwrite the template for the links. but unfortunatly the pager block doesnt have the
page
variable set in next/previous links. it would not hurt to have them in.For reference if someone want to try this: