click problem with CButtonColumn

Inside my CButtonColumn definition, I have the following code




array(

    'class' => 'CButtonColumn',

    'template'=>'{print}',

    'buttons'=>array(

        'print' => array(

            'label'=>'Print',

            'click'=>'alert("test");',

            'visible'=>'1',

             ),

         ),

    ),



as per Yii documentation, I should get an alert, but I don’t. I have tried everything I know and it’s driving me nuts. Am I doing something wrong or is this a known issue?

Any help would be much appreciated.

You should put the javascript code in a function like:


'click'=>'function(){alert("test");}'

Thank you for solving this mystery for me, works like a charm!