<?php echo CHtml::beginForm('','post',array('id'=>'base-si-received-item-form'));?><?php
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'base-si-received-item-grid',
'dataProvider'=>$searchModel->search(),
//'filter'=>$searchModel,
'columns'=>array(
array(
'class'=>'CCheckBoxColumn',
'id'=>'base-si-received-item-id',
'selectableRows'=>2, // multiple rows can be selected
),
array(
'name' => 'details.stockno',
'header'=>'Stock No',
'value' => '$data->details->stockno',
),
array(
'name' => 'details.details_description_search',
'header'=>'Description',
'value' => '$data->details->details_description_search',
),
我的模型
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(
'details' => array(self::BELONGS_TO, 'BaseRefSiDetails', 'details_id'),
);
}
我已经尝试了很多方法,但它们都不起作用..我需要的是显示来自另一个模型的数据,这种关系已经在 gii 生成器的帮助下完成,但仍然没有发现我卡住的结果。