在相关的gridview上找不到结果

时间:2013-01-28 10:13:25

标签: gridview yii foreign-keys relation

<?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生成器的帮助下完成但仍然没有发现我卡住的结果。

0 个答案:

没有答案