如何使用 extraRowColumns 访问 groupgridview 中的关系数据

How to access relationship data in groupgridview with extraRowColumns

数据库表:

project_master (id, project_name)  
task_master (id, task_name, project_id)

TaskMaster 模型中的关系:

TaskMaster.php

class TaskMaster extends CActiveRecord
{
    /**
     * @return array relational rules.
     */
    public function relations()
    {
        // NOTE: you may need to adjust the relation name and the related
        // class name for the relations automatically generated below.  
        return array(
            'ProjectsRpl' => array(self::BELONGS_TO, 'Projects', 'project_id'),
        );
    }
}

以下 GroupGridView 查看文件:

Task.php

$this->widget('ext.groupgridview.GroupGridView', array(
      'id' => 'Customer-grid',
      'dataProvider' => $modelCustomer->searchCustomer(),
      //'mergeColumns' => 'project_id',
      'extraRowColumns' => array('ProjectsRpl.project_name'),
      'extraRowPos' => 'above',
      'afterAjaxUpdate' => 'function(){}',
      'columns'=>$columns,
));

GroupGridView reference site.

出现以下错误:

CException: Column or attribute "ProjectsRpl.project_name" not found!

Task.php 文件中只有一个变化。

$this->widget('ext.groupgridview.GroupGridView', array(
      'id' => 'Customer-grid',
      'dataProvider' => $model->search(),
      //'mergeColumns' => 'project_id',
      'extraRowColumns' => array('project_id'),
      'extraRowPos' => 'above',
      'extraRowExpression' => '"<b style=\"color: black\">".$data->ProjectsRpl->project_name."</b>"',
      'afterAjaxUpdate' => 'function(){}',
      'ajaxUrl' => Yii::app()->createUrl('customer/index'),
      'ajaxUpdate' => true,
      'enablePagination' => true,
      "summaryText" => true,
      'enableSorting' => FALSE,
      'columns'=>$columns,
));