Cgridview Filtering relationship

Hello, I have a CGridView with two columns consisting of relationship values. For the first one, I use a drop-down menu for filtering, and it works great. However, the second one I want using a text field, so I didn’t specify any filtering:


array(

                        'name' => 'uid',

                        'header' => 'User',

                        'value' => '($data->user->username)',

                        'htmlOptions'=>array('width'=>'150'),

        ),

The text field shows up, however, it only returns results that match the input exactly. For example, if I have a User in the grid called “Apple”, I would have to type “Apple” into the filter text field to find all rows with that user. If I typed “App”, those rows wouldn’t show up. However, the other non-relation fields return partial matches. Any way to get this filter to match partials? Any help is appreciated, thanks!

How do you have it set up in your search method for the model? It sounds like you need to add the ‘true’ value to the $criteria->compare() for the user->username

field.

http://www.yiiframework.com/doc/api/1.1/CDbCriteria#compare-detail

Hope that helps!

Oh wow, sorry I’m a Yii noob, thanks for the help!