Another Javascript Problem With Cgridview

Hi everyone:

I modified the auto generated index.php for a table to get an ajaxLink() instead of the tradicional link that redirects to the view.php page. The content of the view file is rendered in a <div> trough the ‘update’ option for the ajaxLink. The problem is that I have a CGridView in each of the view.php pages but the actions specified in the CButtonColumn aren’t executed when the button is clicked. The configuration is as follow


    'class' => 'CButtonColumn',

    'template' => '{deposit}',

    'buttons' => array(

        'deposit' => array(

            'label' => 'Deposit',

            'url' => 'array("somecontroller/someaction", "id" => $data->id)'

            'click' => 'doAjaxCall',




the code of doAjaxCall is

function doAjaxCall(e){


    var href = $(this).attr(href);

    //an ajax call to this href;


I’m sure this script is included.

When the button is clicked the action is executed and the browser is redirected to the controller/action which echo a json encoded array. There is no render nor renderPartial in the action.

I have used this procedure other times but showing the CGridView trough renderPartial not as content retrieved with ajax via ajaxLink. Can this be the problem? How can I obtain the expected behavior?

Another "strange" behavior can be seen in the following code I wrote after the CGridView definition


$cs = Yii::app()->getClientScript();

$cs->registerScript('test', "


", ClientScript::POS_READY);


If the view is rendered with render or renderPartial the “HELLO” string appears in Firebug’s console but when the view is retrieved via ajax as I do with the CGridView the console.log line isn’t executed.

I will appreciate comments and advices.