Ajax in CListView

Hello all

I am using CListView to show the data retrieved from a table. I want to generate a ajaxlink for every record. when i click on the ajaxlink it must post some data to an action in controller class and affects some part of page after success. but when i load the page the link doesn’t work.

my source code is as follows :

_view.php

<div class="view">

&lt;b&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;getAttributeLabel('id')); ?&gt;:&lt;/b&gt;


&lt;?php echo CHtml::ajaxLink(CHtml::encode(&#036;data-&gt;id),CController::createUrl('site/showSingleNews'),array(


	'type'=&gt;'POST',


    'success'=&gt;'js: function(data) {


					


                   &#036;(&quot;#searchDialog&quot;).html(data);


                   &#036;(&quot;#searchDialog&quot;).show();


				 }',


	'data'=&gt;array('id1'=&gt;CHtml::encode(&#036;data-&gt;id)),


    ),array('id'=&gt;CHtml::encode(&#036;data-&gt;id))); ?&gt;


    &lt;br /&gt;





&lt;b&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;getAttributeLabel('title')); ?&gt;:&lt;/b&gt;


&lt;?php echo CHtml::encode(&#036;data-&gt;title); ?&gt;


&lt;br /&gt;





&lt;b&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;getAttributeLabel('abstract')); ?&gt;:&lt;/b&gt;


&lt;?php echo CHtml::encode(&#036;data-&gt;abstract); ?&gt;


&lt;br /&gt;





&lt;b&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;getAttributeLabel('publishDate')); ?&gt;:&lt;/b&gt;


&lt;?php echo CHtml::encode(&#036;data-&gt;publishDate); ?&gt;


&lt;br /&gt;

</div>

=====================================================================

searchPersonal.php

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

'dataProvider'=&gt;&#036;dataprovider,


'itemView'=&gt;'_view',

)); ?>

=====================================================================

two actions in the controller :

public function actionSearch()

{


	//&#036;dataProvider=new CActiveDataProvider('News');


	//&#036;this-&gt;render('index',array(


	//	'dataProvider'=&gt;&#036;dataProvider,


	//));


	&#036;model=new News();


	&#036;dataProvider=&#036;model-&gt;search1(Yii::app()-&gt;user-&gt;getId());


	// renders the view file 'protected/views/site/index.php'


	// using the default layout 'protected/views/layouts/main.php'


	&#036;this-&gt;renderPartial('_searchPersonalNews',array('dataprovider'=&gt;&#036;dataProvider));


}





public function actionShowSingleNews()


{


	


	echo 'test'; 


}

My suggeston is not to use [color=#1C2837][size=2]CHtml::ajaxLink but use raw html links and custom javascript to attach ajax behavior.Then,if you use paging in ListView you should use afterAjaxUpdate property of ListView to reattach the ajax behavior for the links to work with paging.[/size][/color]