I want to present three columns from a table called Customers in a CGridView, the columns are id, name and email.
This is the code I’ve done so far:
<?php $this -> widget('zii.widgets.grid.CGridView', array(
    'dataProvider' => $model -> search(),
    'filter' => $model,
    'columns' => array(
        array(
            'header' => 'Kundid',
            'name' => 'id',
            'type' => 'html',
            'value' => 'l($data -> id, array("customer/view", "id" => $data -> id))',
        ),
        array(
            'name' => 'name',
            'filter' => CHtml::activeTextField($model, ''),
        ),
        'email',
        array(
            'class' => 'CButtonColumn',
            'template' => '{update} {delete}',
        ),
    ),)); ?>
The name column, is retrieved by a getter method in the Customer model that looks like this:
public function getName()
{
    return $this -> firstName .' '. $this -> lastName;
}
The problem is that I want this concatenated column to be both searchable and sortable as any other column in the CGridView, I suspect that a new attribute has to be created for the Customer model and then added to the search criteria within the search() method but I have tried this with no success.
Hopefully someone could shed some light on this one for me, thanks in advance!
