serviceonline 2012-11-12 23:29:11 3666次浏览 1条回复 0 0 0

代码如下:

<?php $this->widget('zii.widgets.grid.CGridView', array(
    'dataProvider'=>Role::model()->search(),
    'columns'=>array(
       // 'role_id',          // display the 'title' attribute
       // 'role_name',  // display the 'name' attribute of the 'category' relation
            array(            // display 'create_time' using an expression
            'name'=>'角色ID',
            'value'=>'$data->role_id',
     
        ),
        array(            // display 'author.username' using an expression
            'name'=>'角色',
            'value'=>'$data->role_name',
        ),
    	array('class'=>'CLinkColumn','label'=>'查看权限','url'=>Yii::app()->createURL('Admin/roleAction/Edit',array('role_id'=>$data->role_id)))
        
    ),
));?>

最后一行CLinkColumn, 无法传递role_id 参数, $data->role_id 一直显示为 “ ” , 请帮忙呀~~

  • 回复于 2014-02-11 16:25 举报

    因为url属性不会解析变量值,可以使用urlExpression参数,详细可参考CLinkColumn类的renderDataCellContent()方法

您需要登录后才可以回复。登录 | 立即注册