Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access to the $data variable from buttons in cgridview

Is the any way, to access model located in $data variable from CButtonColumn? Below code is not working.

array(
'class' => 'CButtonColumn',
'template' => '{test}',
    'buttons' => array(
        'test' => array(
            'label' => 'Select',
            'click' => 'js:function() { <b>alert($data->_id);</b> return false;}',
        ),
    ),
),
like image 465
gryfi Avatar asked Dec 22 '22 15:12

gryfi


1 Answers

It is possible to access visible attributes from jquery:

'click'=>'js:function(){alert("first element in cgridview is"+$(this).parent().parent().children(":nth-child(1)").text());}'
like image 185
chris Avatar answered Jan 22 '23 13:01

chris