How to get the value of the user ID in CGridView - Yii

0

Instead of {{ VALOR DO ID }} I would like to place the ID of the respective user. Seeing that this is a Row of a Grid .

<?php $this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'usuario-grid',
    'dataProvider'=>$model->search(),
    'filter'=>$model,
    'columns'=>array(
        'idUsuario',
        'nome',
        'email',
        array(
            'class'=>'CButtonColumn',
            'template'=>'{view}{update}{delete}',
            'buttons'=>array (
                'view' => array (
                    'options'=> array (
                            'data-url' => Yii::app()->controller->createUrl("view", array("id" => {{ VALOR DO ID }} )),
                    ),
                    'click'=>'function(){
                                   $(".content").load($(this).data("url"));
                              }',
                    'url'=>'"#"',
                ),
            ),
        ),
    ),
)); ?>
    
asked by anonymous 25.04.2014 / 19:38

3 answers

2

I circumvented the situation in this way. However, I do not consider the question answered.

<?php $this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'usuario-grid',
    'dataProvider'=>$model->search(),
    'filter'=>$model,
    'columns'=>array(
        'idUsuario',
        'nome',
        'email',
        array(
            'class'=>'CButtonColumn',
            'template'=>'{view}{update}{delete}',
            'buttons'=>array (
                'view' => array (
                    'click'=>'function(e){
                                   e.preventDefault();
                                   $(".content").load($(this).attr("href"));
                              }',
                    'url'=>'Yii::app()->controller->createUrl("myAction",array("id"=>$data->primaryKey))'
                ),
            ),
        ),
    ),
)); ?>
    
25.04.2014 / 23:44
0
'url' => 'Yii::app()->controller->createUrl("view", array("id"=>$data->idUsuario))'
    
24.05.2014 / 03:35
-1

Try:

'data-url' => Yii::app()->controller->createUrl("view", array("id" => '$data->idUsuario' )),
    
25.04.2014 / 23:10