I am using buttons in a CListView to change the status of the entities listed. Depending on this status I change the label of the buttons. See attachment.
Everything works fine, except when I move to a new page (pagination). There is no Java Script for the buttons on pages other than the initial page.
Partial view _form with CListView:
==================================
<?php $form=$this->beginWidget(‘CActiveForm’, array(
'id'=>'team-form',
'enableAjaxValidation'=>true,
)); ?>
<?php $this->widget(‘zii.widgets.CListView’, array(
'dataProvider'=>$dataProvider,
'itemView'=>'_memberview',
'summaryText'=>'',
'ajaxUpdate'=>true,
'id' => 'teamListView',
)); ?>
Partial view _memberview:
=========================
<div class="view">
<div style ="float:left;" >
<?php
echo CHtml::link(CHtml::encode($data->first) . ' ' . CHtml::encode($data->last) , array('view', 'id'=>$data->id));
?>
</div>
<div style ="float:right; ">
<?php
$url = $this->createUrl('/team/create&id=' . $data->id);
if ($data->getTagged($data->id)=='0') {
echo CHtml::button('Add', array(
'submit' => $url,
'id' => 'button' . $data->id,
));
} else {
echo CHtml::button('Added', array(
'submit' => $url,
'id' => 'button' . $data->id,
));
}
Page source for one of the buttons:
===================================
$(‘body’).on(‘click’,’#button30’,function(){jQuery.yii.submitForm(this,’/yii/TeamDynamics/index.php?r=team/create&id=30’,{});return false;});
I found a similar problem in the forum (link), but no answer.
Any tips for how to make this work?
Thank you,
Dieter