Hi
I just run into a recursive call problem while making an ajax component. Looks like others are also having similar problems. The single solution, I found till date the ZController by Zaccaria , ended up doing the same thing.
The code
Controllers >>
AjaxcomponentsController
<?php
class AjaxcomponentsController extends Controller
{
public function actionAjaxpartcomponent($id)
{
$id.='10';
$this->renderPartial('ajaxpartcomponent',
array('ajaxpartcomponentdata'=>$id),FALSE,TRUE
);
}
}
SiteController
class SiteController extends Controller
{
public function actionAjaxpage()
{
$this->render('ajaxpage',array('data'=>1));
}
}
[b]Views >>
site/ajaxpage.php[/b]
<h2>Ajax Test Page</h2>
<p>Test page for the ajax testing of components system.</p>
<br/><hr/>
<div id="ajaxpartcomponent">
<?php $this->renderPartial('/ajaxcomponents/ajaxpartcomponent',array('ajaxpartcomponentdata'=>$data)); ?>
</div>
<br/><hr/><br/>
<?php echo CHtml::textField('texttextfield'); ?>
Just completed the ajax component render.
ajaxcomponents/ajaxpartcomponent.php
<?php
echo $ajaxpartcomponentdata;
echo CHtml::ajaxButton('Append 10',
Yii::app()->createUrl('/ajaxcomponents/ajaxpartcomponent/',array('id'=>$ajaxpartcomponentdata)),
array('update'=>'#ajaxpartcomponent'),
array('id'=>'ajaxpartbutton')
);
?>
The Problem
when the ‘Append 10’ is clicked the first time a single request is ajaxcomponents/ajaxpartcomponent/1?_xxxxxxxxxxxxx is made.where xxxxxxxxxxxxx is a 13 digit number.
when clicked the second time the requests are
[indent]
ajaxcomponents/ajaxpartcompnent/1?_xxxxxxxxxxxxx
ajaxcomponents/ajaxpartcompnent/110?_xxxxxxxxxxxxx
[/indent]
on third time the requests are
[indent]
ajaxcomponents/ajaxpartcompnent/1?_xxxxxxxxxxxxx
ajaxcomponents/ajaxpartcompnent/110?_xxxxxxxxxxxxx
ajaxcomponents/ajaxpartcompnent/11010?_xxxxxxxxxxxxx
ajaxcomponents/ajaxpartcompnent/110?_xxxxxxxxxxxxx
[/indent]
on fourth time the requests are
[indent]
ajaxcomponents/ajaxpartcompnent/1?_xxxxxxxxxxxxx
ajaxcomponents/ajaxpartcompnent/110?_xxxxxxxxxxxxx
ajaxcomponents/ajaxpartcompnent/11010?_xxxxxxxxxxxxx
ajaxcomponents/ajaxpartcompnent/110?_xxxxxxxxxxxxx
ajaxcomponents/ajaxpartcompnent/11010?_xxxxxxxxxxxxx
ajaxcomponents/ajaxpartcompnent/1101010?_xxxxxxxxxxxxx
ajaxcomponents/ajaxpartcompnent/11010?_xxxxxxxxxxxxx
ajaxcomponents/ajaxpartcompnent/110?_xxxxxxxxxxxxx
[/indent]
and so on, on subsequent requests
The requests are shown in the exact order they are shown by firebug
Using Zcontroller
when using ZController the button do not work at all, and it gives out the same results as without using ZController when I change the renderPartial($view,$data=null,true) in ZController to renderPartial($view,$data=null,true,true)
Am i missing something
Regards
Amit Singh