problems with CGridView using my own search on model

i’m using CGridView with my own search function in the model, data retrieves properly but filters are not working, basically i have clone “search” function but the behavior is different and i dont know why, this is may code

CGridView:

$this->widget(‘zii.widgets.grid.CGridView’, array(

'id'=>'responsables-grid1',


'dataProvider'=>$modRespSearchC->searchCargo(),


'filter'=>$modRespSearchC,





'columns'=>array(


    'apell1Resp',


    'apell2Resp',


    'cargoResp',

Controller

$modRespSearchC=new Responsables(‘searchCargo’);

    $modRespSearchC->unsetAttributes();


    if(isset($_GET['Responsables']))


        $modRespSearchC->attributes=$_GET['Responsables'];

Model

public function searchCargo()

{


    $criteria=new CDbCriteria;


    $criteria->compare('cargoResp',1,true);


    return new CActiveDataProvider($this, array(


        'criteria'=>$criteria,


    ));


}

how you can see is very basic, work but not filtering, what i’m missing??

In your searchCargo() method, your critera is only build by comparing ‘cargoResp’,

but the other attributes/columns values apell1Resp, apell2Resp are ignored.

Add compare criteria for the other searchable attributes to.

Check also the rules() if all are safe on search.

Add properly rules for your’s model scenario