Jquery Sortable In Clistview View

Hi I got this type of view going





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

   // 'isd' => 'my-grid',

    'dataProvider' =>$dataProvider,

	'itemView'=> 'admin_cat',

	'summaryText'=>'',

	'emptyText'=>'',




  

));


?>	






and inside admin_cat is




  <script>

  $(document).ready(function() {

    $("sort").sortable();

  });

  </script>










<ul id="sort">




	<li>	 

	<?php echo CHtml::image(Yii::app()->baseUrl.'/images/icons/folder.png',  'alt',array('width'=>16,'height'=>16)); ?>

	 <?php echo CHtml::link("{$data->Name}",  array('category/update', 'id'=>$data->ID)); ?> 

     <?php echo CHtml::link("{$data->items}",  array('view', 'id'=>$data->ID)); ?>

			

			

	

 </li>

       

		</ul>

		



SO that only moves the 1st row and the rest are ineffective. If I do $(“ul”).sortable(); I can drag each row but it doesn’t place. Basically I can drag but not drop…

Here’s what I gathered, it’s not taking them as 1 UL element because the view itself is looping. So it treats every row as it’s own ul. Anyone have any ideas how I can work this?

Dear ItsYII

I presume that you need every item in the CListView sortable.

I hope the following code can do it.




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

	'dataProvider'=>$dataProvider,

	'itemView'=>'_view',

)); ?>




<?php

Yii::app()->clientSCript->registerCoreScript('jquery.ui');


Yii::app()->clientSCript->registerSCript('sort','

$(".items").sortable();


');

?>



Regards.

Yes that’s done it, thanks. So I’m assuming every time I want to add a jquery action on Clistview I should do it as so Yii::app()->clientSCript->registerSCript(…);

Cheers