Answer the question
In order to leave comments, you need to log in
dataProvider pagination bug or feature?
Hi all!
I have a banal SqlDataProvider
from the model returns new SqlDataProvider([ .. ]);
so here is an interesting feature or bug:
if you do this:
$data['items'] = Catalogs::catalogItems($data['category']['catalog_code'])->getModels();
$data['pagination'] = Catalogs::catalogItems($data['category']['catalog_code'])->getPagination();
_pagination:yii\data\BaseDataProvider:private] => yii\data\Pagination Object
(
[totalCount] => 632
)
$items = Catalogs::catalogItems($data['category']['catalog_code']);
$data['items'] = $items->getModels();
$data['pagination'] = $items->getPagination();
_pagination:yii\data\BaseDataProvider:private] => yii\data\Pagination Object
(
[totalCount] => 0
)
$items = Catalogs::catalogItems($data['category']['catalog_code']);
$data['items'] = [];
$data['pagination'] = $items->getPagination();
Answer the question
In order to leave comments, you need to log in
Figured it out myself.
'totalCount' => $count needs to be added not only to pagination' => [] , but also to go higher.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question