When using CActiveDataProvider, the number of data to be display is base on the pagesize, is there anyway to display all data?
When using CActiveDataProvider, the number of data to be display is base on the pagesize, is there anyway to display all data?
$dataProvider = new CActiveDataProvider('MyModel', array('pagination' => false));
I assume you’re using either CGridView or CListView, so you can set ‘enablePagination’ to false: http://www.yiiframework.com/doc/api/1.1/CBaseListView#enablePagination-detail
I tried ‘pagination’ => false with error : Trying to get property of non-object
It works for me. Can you post your code (both controller action and view)?
controller :
$user = new CActiveDataProvider('User', array(
'criteria'=>array(
'select'=>array(
"t.user_id",
"t.full_name",
"SUM(c.days) + FLOOR(SUM(c.hours) / 6) as days",
"SUM(c.hours) % 6 as hrs",
),
'join'=>'LEFT JOIN tbl_user_course AS uc ON t.user_id = uc.user_id ' .
'LEFT JOIN tbl_course AS c ON uc.course_id = c.course_id ',
'condition'=>'t.dept = :dept AND t.deleted = :deleted ',
'order'=>'days, hrs, full_name',
'group'=>'t.user_id',
'params'=>array(
':dept'=>10,
':deleted'=>'no',
),
),
'pagination' => false,
));
view :
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'report-grid',
'dataProvider'=>$user,
'enablePagination'=>false,
'columns'=>array(
'full_name',
'days',
'hrs',
),
));
error :
PHP Error
Trying to get property of non-object
C:\xampp\htdocs\yii118\framework\base\CComponent.php(619) : eval()'d code(1)