nixie
(Sony Sm)
October 11, 2012, 7:31am
1
anyone can help me, this is my code :
$model = new CActiveDataProvider('GlVoucher',array(
'criteria' => array(
'condition' => "
voucher_date >= '".Yii::app()->session['periode_from']."'
and voucher_date <= '".Yii::app()->session['periode_to']."'",
'select' => 'distinct voucher_no,voucher_date,voucher_remarks as remarks',
'order' => 'voucher_no,voucher_date asc',
),
'pagination'=>array(
'pageSize'=>10
),
'defaultOrder' => 'voucher_date ASC',
),
*/
));
this work for me, but for count of page is not ‘distinct’ first.
the result is have a blank page at the end.
nucreativa
(Nucreativa)
October 11, 2012, 8:12am
2
it’s strange… how can it display 276 results but there is only 154 records.
jacmoe
(Jacob Moen)
October 12, 2012, 6:36pm
3
[color="#006400 "]/* Moved from Bug reports (seriously??) to General Discussion … */ [/color]
apinx
(Apinx01)
January 7, 2013, 2:22am
4
this problems is same with my problems now. can yo solve it?
softark
(Softark)
January 7, 2013, 3:22am
5
Try instead:
'select' => 'voucher_no,voucher_date,voucher_remarks as remarks',
'distinct' => true,
CActiveDataProvider uses CActiveRecord::count() to calculate the total item count. And it eventually uses CDbCommandBuilder::createCountCommand() function.
http://www.yiiframework.com/doc/api/1.1/CDbCommandBuilder#createCountCommand-detail
It assumes that you set ‘distinct’ with ‘distinct’ property of the criteria, not in the ‘select’ property. (Use ‘Show’ link to view the source code.)