Hi is it possible to use pagerfanta pagination on Relay Pagination helper?
The doc example does not help? What do you exactly missing?
The doc example does not help? What do you exactly missing?
in pagerfanta you need page number and limit, paginator helper callback function has offset and limit when i try to dump limit it automatically increment, for example when i put argument "first: 10" then on callback it become 11, hope you can help me. below is my sample code:
query {
provinces(first: 10){
edges{
node{
proNo
proName
}
cursor
}
pageInfo{
hasNextPage
hasPreviousPage
startCursor
endCursor
}
totalCount
}
}
`
$paginator = new Paginator(function ($offset, $limit) use ($args) {
$filters = $args['filters'] ?? array();
$orders = $args['orders'] ?? array();
$numItems = $limit;
$page = ceil(($offset + 1) / $limit);
$pagerfanta = $this->provinceRepository->getPaginatedProvinces($args, $page, $numItems);
$provinces = [];
foreach($pagerfanta->getCurrentPageResults() as $result){
$provinces[] = $result;
}
return $provinces;
});
return array('provinces' => $paginator->auto($args, function() {
$totalCount = $this->provinceRepository->createQueryBuilder('p')
->select('COUNT(p.proCode)')
->getQuery()
->getSingleScalarResult();
return $totalCount;
}));
`
Are Yoh Kenn?
@nckenn the relay paginator works a way difference from a normal paginator. This was created by Facebook for it own use in a first place. This paginator is more like an infinite scroll... If you need some thing more regular maybe you should implement your own logic.
@nckenn the relay paginator works a way difference from a normal paginator. This was created by Facebook for it own use in a first place. This paginator is more like an infinite scroll... If you need some thing more regular maybe you should implement your own logic.
@nckenn the relay paginator works a way difference from a normal paginator. This was created by Facebook for it own use in a first place. This paginator is more like an infinite scroll... If you need some thing more regular maybe you should implement your own logic.
thanks ;)
I'm closing this, don't hesitate to continue discussion if needed :+1:
Most helpful comment
Are Yoh Kenn?