how can i count data that will retrieved by $dataProvider ? i've tried to use this code,
$dataProvider = new CActiveDataProvider('Model');
$dataProvider->totalItemCount;
In yii2
For total count use
$dataProvider->getTotalCount()
For page count then
$dataProvider->getCount()
Refrence page http://www.yiiframework.com/doc-2.0/yii-data-basedataprovider.html#getTotalCount()-detail
I think you have to first fill the dataprovider with data then get the count:
$dataProvider->getData();
var_dump($dataProvider->totalItemCount);
or use the function to retrieve directly:
var_dump($dataProvider->getTotalItemCount());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With