CListView ajax pagination and widget working at ajaxLink

i have simple widget like this:

<?php $id = unique(); ?>

<div id="widget_id_prefix_"<?php echo $id; ?>">


echo CHtml::ajaxLink(

					Yii::t('site','Add to favorite'),



						'type' => 'POST',

						'replace' => '#widget_id_prefix_' . $id,

						'dataType' => 'html',










Next step, i use this widget on render my CDetailView widget like this

template: _favorites.php

$this->widget('zii.widgets.CDetailView', array(

    'data' => $data,

    'attributes' => array(


            'label' => 'Favorite',


            'value'=> $this->widget('FavoriteLinkWidget', array(...),true),




and it’s all repeated by CListView with default ajax pagination like this

$this->widget('zii.widgets.CListView', array(




at last, code from my controller


            $this->renderPartial('index', compact('dataProvider'),false, true);


            $this->render('index', compact('dataProvider'));

at first page it works fine, but when i click on next page, ajaxLink stops working.

maybe it’s not working because of the scripts are loaded at the wrong time?

Did you find any solution?

ugly solution.

your can use CHtml::link instead of CHtml::ajaxLink like this


	Yii::t('site','Hide talk'),

	Yii::app()->createUrl('#'), array(

		'onclick' => CHtml::ajax(array(

			'url' => Yii::app()->createUrl('/user/message/removetalk'),

			'replace' => '#'.$id,

			'type' => 'GET',

			'dataType' => 'html',




		)) . 'return false;'