dimis283
(Dimis283)
February 11, 2010, 9:12am
1
I am using the admin page of the crud command and I create a search form.
My problem is that when I search something that have 2 or more pages of pagination when I push some page the critiria of the search form are not there, all the customers are there.
What is wrong.
dimis283
(Dimis283)
February 11, 2010, 9:19am
2
I write this, it is the best solution?
public function actionIndex() {
$model=new searchcustomer;
if(isset($_POST['searchcustomer']) ) {
$model->attributes=$_POST['searchcustomer'];
$arr=array(
'pagination'=>array(
'pageSize'=>self::PAGE_SIZE,
'params'=>array('name'=>$model->CUSTOMER_NAME)
),
'criteria'=>array(
'condition'=>'CUSTOMER_NAME LIKE :tags',
'params'=>array(':tags'=>'%'.$model->CUSTOMER_NAME.'%'),
),
);
}
else if (isset ($_GET['name'])) {
$arr=array(
'pagination'=>array(
'pageSize'=>self::PAGE_SIZE,
'params'=>array('name'=>$_GET['name'])
),
'criteria'=>array(
'condition'=>'CUSTOMER_NAME LIKE :tags',
'params'=>array(':tags'=>'%'.$_GET['name'].'%'),
),
);
}
else
$arr=array(
'pagination'=>array(
'pageSize'=>self::PAGE_SIZE,
),
);
$dataProvider=new CActiveDataProvider('customers', $arr);
$this->render('admin',array(
'dataProvider'=>$dataProvider,
'model'=>$model,
));
}