here is how I did it:
My model BuyerContracts, the search portion:
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('t.id',$this->id);
$criteria->compare('t.offer_id',$this->offer_id);
$criteria->compare('t.buyer_id',$this->buyer_id);
$criteria->compare('t.campaign_id',$this->campaign_id);
$criteria->compare('t.status',$this->status);
$criteria->compare('t.credit_limit',$this->credit_limit);
$criteria->compare('t.cap_limit',$this->cap_limit);
$criteria->compare('date(t.starts_on)',$this->starts_on,true);
$criteria->compare('date(t.expires_on)',$this->expires_on,true);
$criteria->compare('date(t.created)',$this->created,true);
$criteria->with = array(
'offer'=>array('select'=>'offer.name'),
'buyer'=>array('select'=>'buyer.name'),
'campaign'=>array('select'=>'campaign.name'),
);
return new CActiveDataProvider(get_class($this), array(
'criteria'=>$criteria,
));
}
and then the view that has the grid view:
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'buyer-contracts-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'id',
//'offer_id',
array(
'filter'=>Offers::model()->forList(),
'name'=>'offer_id',
'value'=>'$data->offer->name'
),
//'buyer_id',
array(
'filter'=>Buyers::model()->forList(),
'name'=>'buyer_id',
'value'=>'$data->buyer->name'
),
//'campaign_id',
array(
'filter'=>Campaigns::model()->forList(),
'name'=>'campaign_id',
'value'=>'(isset($data->campaign) ? $data->campaign->name : "")'
),
//'status',
array(
'filter'=>array('inactive','active'),
'name'=>'status',
),
'credit_limit',
'cap_limit',
'price_per_lead',
'starts_on',
'expires_on',
'created',
//'last_modified',
array(
'class'=>'CButtonColumn',
),
),
)); ?>
Notice that for the filter bits, the model function Offers::model()->forlist() just returns a one dimensional array, like id=>name