Help With Cgridview Column Titles

Hi all,

I am putting together a table of data that includes both relational data and a function to merge 3 fields together and display the result of the merge.

I am having a problem with a certain part of it and was hoping that someone could point me in the right direction.

I have a function in my ‘People’ model that merges the fields together -


      public function getFullName() {

            $fullnameArray = array();


            if ($this->crmPersonTitle->global_title_description)

                  $fullnameArray[] = $this->crmPersonTitle->global_title_description;


            if ($this->crm_person_forename)

                  $fullnameArray[] = $this->crm_person_forename;


            if ($this->crm_person_surname)

                  $fullnameArray[] = $this->crm_person_surname;


            return implode(' ', $fullnameArray);

      }

This would then display the name as Mr John Smith for example.

I am then trying to display this data in a related ‘Properties’ model CGridView. My current CGridView looks like this -


$this->widget('zii.widgets.grid.CGridView', array(

    'id' => 'properties-grid',

    'dataProvider' => $model->search(),

    'columns' => array(

        'pr_id',

        'pr_updated',

        'prSurveyor.FullName',

        'prAdministrator.FullName',

        array(

            'class' => 'CButtonColumn',

            'buttons' => array(

                'update' => array(

                    'label' => '<i class="icon-home"></i> <span>View Property</span>',

                    'options' => array('class' => 'btn btn-small'),

                ),

            ),

        ),

    ),

));

The problem is this displays the correct data in the cell but the header is wrong (displays Full Name). I have tried to get around this by using the following for the columns -


        array(

            'header' => 'Administrator',

            'name' => 'pr_administrator',

            'value' => '$data->prSurveyor.FullName',

        ),

When I do this the header is correct but the cell displays as ‘FullName’.

Does anyone know how this can be fixed?

Many thanks in advance.

Figured it out…

CGridView column should be -


        array(

            'header' => 'Administrator',

            'name' => 'pr_administrator',

            'value' => '$data->prAdministrator->FullName',

        ),

Many thanks