Slidetoggle Opens And Closes 4 Times.

Hello,

I have been using Yii for about a year now but still consider myself a noob. I built a Yii website for a friend and his nonprofit and included in it was an ability to create trips. The problem we are now having is that there are too many trips to put on a single page. At least to put them forward in all their glory. So, I installed the slidetoggle ext. thinking it might button things down a bit. And, happy to say, all is working just great. Except, that when I click on a trip it opens and closes 4 times. If I close it, it closes and opens 4 times.

Does anybody have any experience with this?

FYI, The widget code is on a render_partial page that is called as the result of a Clist_view from an index.php page.

Here is the CList_view on the index.php:


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

	'dataProvider'=>$dataProvider,

    'afterAjaxUpdate' => 'function(){

$("html, body").animate({scrollTop: $("#scrollTop").position().top }, 100);}',

	'summaryText'=>false,

	'itemView'=>'_view',

)); ?>

Relevant code in the _view file:


<?php /* */

$this->widget('ext.slidetoggle.ESlidetoggle',

  array(

   'itemSelector' => 'fieldset',

   'titleSelector' => 'fieldset legend',

   'collapsed' => 'fieldset',

  )); 

?>

Any help would be deeply appreciated.

Thanks.

Are you getting ahy JS console errors? Could it have something to do with this?

Matt

Matt, thanks for the reply. But, I am not using the twitter bootstrap. And, I don’t see any other errors. Again, thanks.

K, I would then assume that the ESlidetoggle scripts are being registered for each list item and are causing multiple click events to fire. Try moving the widget to the index file so its only registered once.

Matt

Bamm!!! Worked perfectly. Thank you, Matt.