Searching and sorting by related model in CGridView

Comparing #1 with #3

Content

[...]
```php
$criteria = new CDbCriteria;
$criteria->with = array( 'author' );
...
$criteria->compare( 'author.
username', $this->author_search, true );
...
```
[...]
'attributes'=>array(
'author_search'=>array(
'asc'=>'author.
username', 'desc'=>'author.username DESC',
),
'*',
[...]
'title',
'post_time',
array( 'name'=>'author_search', 'value'=>'$data->author->
nameusername' ),
 
        //post strictly required user but in any case that model has not required user(or another relation) you should replace with it
 
        array( 'name'=>'author_search', 'value'=>'$data->author ? $data->author->username: "-"
' ),
array(
'class'=>'CButtonColumn',
),
),
));
[...]