Difference between #2 and #3 of
Searching and sorting by related model in CGridView

Revision #3 has been created by Kostas Apazidis (KonApaz) on May 16, 2014, 1:15:03 PM with the memo:

in case that not strictly required related model
« previous (#2)

Changes

Title unchanged

Searching and sorting by related model in CGridView

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

active record, relations, CGridView

Content changed

[...]
'filter'=>$model,
'columns'=>array(
'title',
'post_time',
array( 'name'=>'author_search', 'value'=>'$data->author->username' ),
        //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',
),
),
));
```
[...]
77 0
93 followers
Viewed: 274 203 times
Version: 1.1
Category: Tutorials
Written by: Maciej Liżewski
Last updated by: Kostas Apazidis (KonApaz)
Created on: Dec 1, 2011
Last updated: 9 years ago
Update Article

Revisions

View all history