Difference between #3 and #4 of
View a related field in CGridView

Revision #4 has been created by rafaelt88 on Jun 30, 2015, 9:09:23 PM with the memo:

View a related field in CGridView
« previous (#3)

Changes

Title unchanged

View a related field in CGridView

Category unchanged

Tips

Yii version unchanged

Tags unchanged

CGridView, Relation Field

Content changed

[...]
2) First, it is necessary to specify that the model will use the relationship defined above; Then, the comparison between the related field and a variable is defined; Finally, specify what will be the order for the field shown in CGriView.
~~~~
class TableB extends ActiveRecord {
...
public function search() {
$criteria = new CDbCriteria();
$criteria->with = array('tableA');
...
[...]
array(
'name' => 'tableA.name',
      'value' => '$data->tableA->name)',
 
'filter' => CHtml::textField('tableA_name', Yii::app()->request->getParam('tableA_name')),
),
...
),
...
));
[...]
2 0
3 followers
Viewed: 19 110 times
Version: 1.1
Category: Tips
Written by: rafaelt88
Last updated by: rafaelt88
Created on: Jun 26, 2014
Last updated: 9 years ago
Update Article

Revisions

View all history