CDbCriteria & CGridView Problem


This is my first post so be gentle with me :D

I’ve just arrived at Yii after using PHP for ages. I’m still getting to grips with the various nuances of yii but it’s going good so far. Read a lot over the past few days and it’s sinking in.

I’m working on a few simple test projects to get my feet wet and after many hours working on this problem I’ve finally admitted defeat. I’m sure it’s simple but for the life of me I can’t figure it out.

I’m trying to make my grid searchable. All works fine apart from the one column that holds the ‘Classification’. The actual value is an integer for the id but I’m displaying the actual name which is what I’d like to search on.

If I search on the integer I get results but if I try to search on the string value (the actual name),I get nothing.

I don’t want to put loads of needless code up here because I’ve seen how annoying that is so I’ll try to just post the salient bits.

My criteria looks like this…






and my admin view code looks like this…

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










				" .$data->classificationName->classification'



                'class' => 'CButtonColumn',



)); ?>

Hopefully that’s enough for somebody more adept with yii to see the obvious mistake I’m making but if not please let me know what you need.



this is what you are looking for:

Thanks for that. Looks like exactly what I need. Reading it now.