I would advise you to generate a model and CRUD with Gii... and then inspect the generated code...
so that you get a grasp about how the filtering in CGridView works... mainly using the $model->search() function