JColorBox

Hi guys, I need your help.

I show images with CListView. Images count on the CListView’s page are 10. To show original images on clicking thumb images I use JColorBox. It’s working. But on second and more pages it’s not working. Image opened on new page, not on jcolorbox.

How can I fix that?

Sorry for my English.

That you probably need to do is re-initialize the plugin. Check the docs, there should be a parameter like ‘afterUpdate’ or something like that, where you will need to re-initialize your JColorBox plugin.

Thanks andrew2mar for your reply. I also noticed it after posting here. I opened CListView source code and saw the parameter afterAjaxUpdate.




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

 'dataProvider'=>$dataProvider,

 ...

 ...

 ...

 'afterAjaxUpdate'=>'jQuery(\'a[rel="example1"]\').color......'

));



But that is not working. :(




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

	'dataProvider'=>$dataProvider,

	//'itemView'=>'_view',

	'itemView'=>'_photos',

	'columnCount'=>3,

	'afterAjaxUpdate'=>"jQuery('a[rel=\"example1\"]').colorbox({'transition':'fade','slideshow':true,'maxWidth':700,'maxHeight':800})",

)); ?>



it produce this javascript code




jQuery('#yw0').yiiListView({'ajaxUpdate':['yw0'],'ajaxVar':'ajax','pagerClass':'pager','loadingClass':'list-view-loading','sorterClass':'sorter','afterAjaxUpdate':jQuery('a[rel="example1"]').colorbox({'transition':'fade','slideshow':true,'maxWidth':700,'maxHeight':800})});



if i run the same jquery code in firebug’s console after ajax request, it’s working.




jQuery('a[rel="example1"]').colorbox({'transition':'fade','slideshow':true,'maxWidth':700,'maxHeight':800})



What do I do wrong?




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

	'dataProvider'=>$dataProvider,

	//'itemView'=>'_view',

	'itemView'=>'_photos',

	'columnCount'=>3,

	'afterAjaxUpdate'=>"alert('Hello World!!!');",

)); ?>



‘afterAjaxUPdate’ - it works only one time, after web page loading, but not on ajax page loading.

I did it!


'afterAjaxUpdate'=>"function (id,data) { alert('Hello World!!!); }",

:)

Thanks to everyone who tried to help.