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

Revision #2 has been created by Maciej Liżewski on Dec 1, 2011, 6:51:53 PM with the memo:

How to allow searching and sorting with respect to related active record column in CGridView
« previous (#1) next (#3) »

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

[...]
```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->
username' ),
array(
'class'=>'CButtonColumn',
),
),
));
[...]
77 0
93 followers
Viewed: 273 331 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