Closed stesifrancesco closed 7 years ago
You must configure totalCount
property of the SqlDataProvider to the total record count value. This is required for SqlDataProvider
as highlighted in Yii Docs and you should be able to see that in Dynagrid output (confirmed as tested by me separately).
However I am noting an enhancement for data providers other than active data providers.
Hi Kartik and thanks for your answer. You mean in this way: $itemsCount = $query->count(); ? Because I alredy tried in this way without success
Set dataProvider['totalCount'] = 40
for example and try. That should show total count showing up as 40
.
Once you tested that - then you need to check how you calculate the total count from your query.
dataProvider for what I know is an object, so I alredy tried to set:
$dataProvider->setTotalCount(40);
either
$dataProvider = new SqlDataProvider([
'sql' => $query->createCommand()->getRawSql(),
'totalCount' => 40,
'key' => 'id',
'pagination' => [
'pageSize' => 7
],
'sort'=> ['attributes'=>[
"id",
"code",
"name",
"vat_id",
"active",
"customer",
"supplier",
"created_at",
"created_by",
"parameters"
]]
]);
Without success....(showin 1-10 of 0 elements)
As I wrote this issue is only with dynagrid. With your grid and with the same data provider all work without problems.
This is resolved via this mega commit for updates to release v1.4.5.
Now It works fine: Thanks a lot !
I'm tring to use dynagrid with sql data provider. All seems to wirk properly except pagination, for example if I try to show 5 items for page I got this:
Showing 1-5 of 0 elements (I have 18 elements in my data provider)
Here is my data-provider:
One more information: if I use the same DataProvider with simple Grid (without dynagrid I got correctly Showing 1-5 of 18 elements)
Any idea ?
Thanks in advance for your supports (and many thanks to kartik fro it's wonderful extensions)
Francesco