just simple ajaxLink Question

ive got a tree with some ajaxLinks




 <?php $my_tree = array(

		array(

		'text'     => 'Node 1',

	'children' => array(

	array(

		'text'     => $Link1,

		'children' => array(

		array(

	'text' => "Node 1.1.1",

		),

		)

		),

	array(

	'text'     => 'Node 1.2',

	'children' => array(

	array(

	'text' => $Link2,

		),

		)

			),

			)

			),

		);

			   ?>




here the links




 <?php

   $Link1=CHtml::ajaxLink ("Link 1",

		  CController::createUrl('site/Link1'),

		  array('update' => '#erg', 'type' => 'POST'));


   $Link2=CHtml::ajaxLink ("Link 2",

		  CController::createUrl('site/Link2'),

		  array('update' => '#erg', 'type' => 'POST'));


   ?>









<div id="erg">

<?php echo $erg; ?>


</div>



here the controller





// Links

		public function actionLink1()

		{

			$erg="Link1";


			$this->render('index', array('erg' =>$erg));


		}



so when i press the Link . this works without problems but everytime i got the full site

.

i want just have the String on the Result but i get everytime the full Site

so its look like the Attac…

thanx

I think you should use $this->renderPartial instead of $this->render().

works. thanx a lot.

it works but got a problem .

example i used a Draggable to Drag some Picture

works fine but after a AJAX Request i load new Pictures but now the are not Draggable anymore

if i used




$this->render('index',array(

			'dataProvider'=>$dataProvider,

		));



it works but i have the problem look at the first topic

if i user renderPartial i can Drag the Pictures anymore after a Request

Controller




$this->renderPartial('index',array(

			'dataProvider'=>$dataProvider,

		));






view




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

    'dataProvider'=>$dataProvider,

    'itemView'=>'_view',  

)); ?>






_view Data from Database with the




 <?php $this->beginwidget('zii.widgets.jui.CJuiDraggable', array(

		'id' => $data->id,

		'options' => array(

                'scope' => 'drag',

		'revert' => true,

                'opacity' => 0.30,

		)

		));?>



It’s possible that your javascript code is removed after your ajax call.

Try calling renderPartial with the following parameters:




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



hi,

thanx for the answer. ye the javascript code is remove after update.

i tried it with but same issue


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

works

ok works. tried it again .




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