i have simple widget like this:
<?php $id = unique(); ?>
<div id="widget_id_prefix_"<?php echo $id; ?>">
<?php
echo CHtml::ajaxLink(
Yii::t('site','Add to favorite'),
array('/default/favorite.ajax'),
array(
'type' => 'POST',
'replace' => '#widget_id_prefix_' . $id,
'dataType' => 'html',
'data'=>array(
'fav_uid'=>$this->fav_uid,
'action'=>'add',
)
)
,array(
'id'=>'fw_link'.$id
)
);
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(
array(
'label' => 'Favorite',
'type'=>'raw',
'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(
'dataProvider'=>$dataProvider,
'itemView'=>'_favorites',
));
at last, code from my controller
if(Yii::app()->request->isAjaxRequest)
$this->renderPartial('index', compact('dataProvider'),false, true);
else
$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?