Hello Experts,
Are you familiar with the pagination function of yii or more specific the pagination in the CActiveDataProvider?
There seems to be a problem with the synchronization of the pagenumbers with the actual data.
I use a web form on the index page of the site to search for specific data in a database. If I submit this form, a table with the searched information get displayed in a table (zii.widgets.grid.CGridView) located under the form. The data is shown correctly on page 1. But if I click the link to page 2, I get a second page which contains not only the searched data, but all data from the underlying table.
This is my data provider:
$dataProvider=new CActiveDataProvider('View_Suppression_Hist', array(
'sort'=>array(
'attributes'=>array(
'account_id', 'suppression_list_dt',
),
),
'pagination'=>array(
'pageSize' => 10,
),
));
And here is the controller code that asks for the data:
public function actionIndex()
{
$model=new View_Suppression_Hist;
$dataProvider = $this->getSourcesTable();
if(isset($_POST['View_Suppression_Hist']))
{
$model->attributes=$_POST['View_Suppression_Hist'];
if($model->validate())
{
$dataProvider = $model->search();
}
}
$this->render('index',array(
'model'=>$model,
'dataProvider' => $dataProvider
)
);
}
The view widget looks as follows:
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider,
'enablePagination'=>true
));
I want to achieve that the second page just shows up the rest of the searched data and not everything. Maybe the criteria is getting lost between multiple page loads?
Thanks in advance for your support.
Best Regards,
Moe