Hi…
i have problem when search data in GridView, i want to filter customer field(firstname & lastname).
this search code in customer model
public function search()
{
$criteria=new CDbCriteria;
$criteria->condition = "status>=:sts";
$criteria->params = array(':sts'=>0);
$criteria->compare('firstname',$this->firstname,true);
$criteria->compare('lastname',$this->lastname,true);
return new CActiveDataProvider(get_class($this), array(
'criteria'=>$criteria,
));
}
and GridView code:
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'gridcust',
'filter'=>$model,
'dataProvider'=>$model->search(),
'columns'=>array(
array(
'header'=>Yii::t('MGlobal', 'tbl.custname'),
'value'=>'$data[firstname]." ".$data[lastname]',
'name'=>'firstname',
),
so my questions are :
-
how to search firstname and lastname within one column
-
when i put value in textbox and press enter filter does not work.
(i want to filter firstname eka
but data not changed).
I’ve tried to find a way, but still not successful.
thanks