Answer the question
In order to leave comments, you need to log in
Why is pagination not working in Yii2?
Good afternoon! I use standard Yii2 pagination:
There is an array $records
Array
(
[0] => Array
(
[RecipientLegalName] => AAA
[Service Name] => BBB
[Payment Identifier] => CCC
[Payment Number] => DDD
[Payment Account] => EEE
[Recipient Sum, MDL] => FFF
[Payment State] => Завершен
[State Time] => 2018-08-01 00:30:05
)
[1] => Array
(
[RecipientLegalName] => QQQQ
[Service Name] => WWWWW
[Payment Identifier] => TTTT
[Payment Account] => PPPP
[Recipient Sum, MDL] => FFF
[Payment State] => Завершен
[State Time] => 2018-08-01 07:32:53
)
)
Answer the question
In order to leave comments, you need to log in
Throws an error Call to a member function offset() on array
$records = [1, 2, 3, 4, 5];
$arrayDataProvider = new ArrayDataProvider();
$arrayDataProvider->setModels($records);
$posts = $arrayDataProvider->getModels(); // depends on items per page
$pages = $arrayDataProvider->getPagination();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question