Help Ajaxing A Cgridview Within An Ajaxed Container

I’ve been trying to get a CGridView to ajax itself. The problem is, I’, using an ajaxed container that has some elements in addition to the CGridView.

I’ve made an action that outputs the grid only that looks like this:




public function actionGetGridView()

{

    $dataProvider = new CActiveDataProvider('Test');


    $this->renderPartial(

        'gridView',

        array(

            'dataProvider' => $dataProvider,

        ),

        false,

        true

    );

}



Inside the ‘gridView’ view, I use code like this:




$this->widget(

    'zii.widgets.grid.CGridView',

    array(

        'ajaxUrl' => Yii::app()->createAbsoluteUrl('site/getGridView'),

        'dataProvider'=> $dataProvider,

        'columns' => array(

            'col1',

            'col2',

            'col3',

        ),

        'summaryText' => ''

    )

);



When I go to the action directly it works great, but when I renderPartial() the action in ajaxed content, like this:




$dataProvider = new CActiveDataProvider('Test');

    

$this->renderPartial(

    'gridView',

    array(

        'dataProvider' => $dataProvider,

    ),

    false,

    true

);



it just redirects the entire page to the action that generated the entire ajaxed content, including the extra form elements. It seems like the ajaxUrl property is not working, and I’m not sure what to do. I know there’s some javascript that gets loaded dynamically and won’t be loaded on ajax, but I’ve tried to manually load it and it still doesn’t work. Maybe I’m missing something?

Help!

Have you tried to remove ajaxUrl attribute?

Still no luck. It’s like the attribute doesn’t exist! It did the exact same thing.

When happens that

"it just redirects the entire page to the action that generated the entire ajaxed content, including the extra form elements. It seems like the ajaxUrl property is not working"

?

It happens when I try to sort by a column. I click the <th> that corresponds with sorting the column, and instead of only changing the content of the CGridView, it loads an entirely new page and I lose all data outside my ajaxed content.

Thanks for your help, by the way.

Empty cache and try to debug with firebug.