This question directly follow this other
I have this tables: Groups, Users, Reports
Relations: Groups 1 -> N Users ** and ** Users 1 -> N Reports
I already have this relation In Report model:
'user' => array(self::BELONGS_TO, 'Users', 'userId'),
And this in User model
'group' => array(self::BELONGS_TO, 'Gruppi', 'groupId'),
In Report Model I have this:
$criteria=new CDbCriteria;
$criteria->with = array ('user');
In the admin view of report I'm using a CGridView.
I'm using user.group.name for showing group name, but how to search (by DropDown) and sort !?
In admin view, instead of user.group.name, i'm using
In Report model I added a class field
In Report rules
In Report search
In this way I can search, and sort, by group name !
I hope this post can be usefull to someon