Yii Framework Forum: just simple ajaxLink Question - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

just simple ajaxLink Question Rate Topic: -----

#1 User is offline   james2010 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 19-February 10

Posted 07 April 2010 - 09:14 AM

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

Attached File(s)


0

#2 User is offline   seb 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 240
  • Joined: 29-June 09

Posted 07 April 2010 - 10:33 AM

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

#3 User is offline   james2010 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 19-February 10

Posted 08 April 2010 - 01:37 AM

View Postseb, on 07 April 2010 - 10:33 AM, said:

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


works. thanx a lot.
0

#4 User is offline   james2010 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 19-February 10

Posted 23 April 2010 - 04:25 PM

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,
		)
		));?>

0

#5 User is offline   Onman 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 175
  • Joined: 26-December 09
  • Location:The Netherlands

Posted 24 April 2010 - 12:07 AM

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);

0

#6 User is offline   james2010 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 19-February 10

Posted 24 April 2010 - 10:21 AM

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);

0

#7 User is offline   james2010 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 19-February 10

Posted 27 April 2010 - 07:07 AM

works
0

#8 User is offline   james2010 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 19-February 10

Posted 27 April 2010 - 07:27 AM

ok works. tried it again .
$this->renderPartial('index',array('dataProvider'=>$dataProvider),false,true);


0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users