<?php $this->widget('bootstrap.widgets.TbGridView',array(
'id'=>'ref-mahala-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'id',
'district_id',
'name_ru',
'name_uz',
'name_en',
'address_ru',
array(
'class'=>'bootstrap.widgets.TbButtonColumn',
),
),
)); ?>
в дистрик_ид приходят ид , по этому ид я должен достать запись из подвязки.
Модель.
public function search()
{
// @todo Please modify the following code to remove attributes that should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('id',$this->id);
$criteria->compare('district_id',$this->region['name_ru']);
$criteria->compare('name_ru',$this->name_ru,true);
$criteria->compare('name_en',$this->name_en,true);
$criteria->compare('address_ru',$this->address_ru,true);
$criteria->compare('address_en',$this->address_en,true);
$criteria->compare('sort',$this->sort);
$criteria->compare('active',$this->active);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
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(
'region' => array(self::BELONGS_TO, 'RefRegion', 'district_id'),
);
}