【问题标题】:yii how to put link to another form in cgridviewyii如何将链接放在cgridview中的另一个表单
【发布时间】:2016-07-27 16:01:03
【问题描述】:

如何在类代码中添加链接以进入另一个表单

<?php $this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'classlist-grid',
    'dataProvider'=>$model->search(),
    'filter'=>$model,
    'columns'=>array(
        **'classCode'**,
        'classDesc',
        array(
            'class'=>'CButtonColumn',
        ),
    ),
)); ?>

【问题讨论】:

  • 链接到另一个表单的意思。给出你想要的解释

标签: yii cgridview


【解决方案1】:

你可以使用叮当柱

'columns'=>array(
   .....
    array(
      'class'=>'CLinkColumn',
      'label'=>'your_attribute',
      'url'=>'your_controller/your_action&id='.$model->your_attribute,
     'header'=>'your_column_header'
  ),

【讨论】:

    【解决方案2】:

    你也可以用这个

    array(
       'name' => 'you_field',
       'header' => 'label',
       'type' => 'raw',
       'value' => 'CHtml::link($data->you_field,Yii::app()->createUrl("controller/action",array("param"=>$data->you_field)),array("target"=>"_blank"))',
    ),
    

    【讨论】:

      【解决方案3】:

      您好,请使用此代码,

       array(
                                  'header' =>Your Header Name,
                                  'value' => '$data->subject->subject_name."  -  ".$data->subject->subject_code',
      'url' => 'Yii::app()->createUrl("core/subject/deleteelective", array("id"=>$data->electivesubjectid))',
                                  'htmlOptions' => array('width' => '45%'),
                              ),
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多