Hi All,
I have been trying to use CArrayDataprovider with filter and pagination. This works all fine when i first load the page.
The problem starts when I use my search. The first time it loads the data correctly. But once I paginate from the page, it loads all the data. Not the ones that were searched for. Below is my code:
Controller:
public function actionTest() {
/* pagination with CArrayDataProvider */
$sql = $this->searchLogs();
$callLogs = Yii::app()->db->createCommand($sql)->queryAll();
$dp = new CArrayDataProvider($callLogs, array(
'keyField' => 'ticket_id',
'pagination' => array(
'pageSize' => 10,
),
));
$this->render('test', array(
'model' => $dp,
));
}
View:
<?php
$gridWidget = $this->widget('bootstrap.widgets.TbGridView', array(
'dataProvider' => $model,
'columns' => array(
'id: Id',
'name: Name',
'mobile: Mobile',
'created_date: Created Date',
array(
'class' => 'bootstrap.widgets.TbButtonColumn',
'header' => 'Operations',
'template' => '{view}',
),
),
));
?>
Thank you.