kalempir
(Asanjarbek)
August 16, 2011, 4:50am
1
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.
kalempir:
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.
kalempir
(Asanjarbek)
August 17, 2011, 4:03am
3
andrew2mar:
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.
kalempir
(Asanjarbek)
August 17, 2011, 4:34am
4
kalempir:
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?
kalempir
(Asanjarbek)
August 17, 2011, 5:27am
5
<?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.
kalempir
(Asanjarbek)
August 17, 2011, 5:36am
6
kalempir:
<?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.