[Solved] Searching On Cgridview

Hi Everyone,

I created my Card Manager module and I have my admin page like:

<?php $this->widget('zii.widgets.grid.CGridView', array(








		array('name'=>'value', 'value'=>'number_format($data->value, 0, ",", ".")'),



		array('name'=>'status', 'value'=>'$data->getStatus()'),

		array('name'=>'import_user_id', 'value'=>'$data->getImportUser($data->import_user_id)'),







)); ?>

The function return:

$status = 0; ==> $data->getStatus() return "Not Use".

$status = 1; ==> $data->getStatus() return "Sold Out".

$import_user_id = 1; ==> $data->getImportUser(1) return "admin".

So now when I used

$model=new StoreCard('search');

and type Not Use on Status search field

or admin on Import User field

couldn’t get anyrecord

But if I type value 0,1,… it return the records!

Anyone could help me, got thanks!

Dear Friend

We have to add filters to dataColumn.




    'filter'=>array(0=>"Not Use",1=>"Sold Out"),









Here I have assumed you have user table with a column username and

user.id is identical to ‘import_user_id’.