Fancybox Problem With Gridview

Hi All

I used FancyBox extension

I added fancy box to update action in grid view button , it’s work in perfect way in first results page , But the problem is in second page not work ?

how to fix that

Thanks in advance

my view :


$config = array( 

	'titleShow' => false,


/// Add fancy box Ext 

$this->widget('application.extensions.fancybox.EFancyBox', array(



$this->widget('application.extensions.fancybox.EFancyBox', array(




<div class="texts"><?php echo CHtml::link('إضافةبرشور',array('pam/create'),array('id'=>'add')); ?></div>

<div class="texts"><?php echo CHtml::link('بحث متقدم','#',array('class'=>'search-button')); ?></div>

<div class="search-form" style="display:none">

<?php $this->renderPartial('_search',array(


)); ?>

</div><!-- search-form -->


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




	'cssFile' => Yii::app()->request->baseUrl."/css/gridview/styles.css",








                   	'header'=>'نوع الملف',






		   	'template'=>'{update} {view} {delete}',
























      	'click'=>'function(){return confirm("هل انت متأكد?");}'













CGridView uses AJAX to update (by default) in doing so it removes the elements that were originally hooked by and brings in new ones. This is why moving to another page or reordering won’t trigger fancybox. You can set CGridView to run a jQuery function to hook the new elements after CGridView updates by using the property afterAjaxUpdate.

'afterAjaxUpdate'=>'function(id, data) {jQuery(".update").fancybox(); }

Dear Friend

At the top of the grid you call the widget only one time.


At the bottom of grid ,we have to register the script in the following way.





	return false;



I hope this would solve the issue.


Genosha thanks for your explain .

My bro seenivasan , yes it’s work and you sloved my problem thank u so much .

My Friend seenivasan , I had new problem it’s work in perfect way in Firefox but fancybox not work in

Google Chrome !

do you have any idea why ?

You are absolutely right My Dear Friend.

This is due to the fact I have chosen wrong event type.

Originally I have chosen "click" event.But for unknown reason I have to click twice to get it done.

So I have chosen "focus" event.

Yes as you said it is not working in my chromium browser.

Now I replaced it with "mousedown" event.

It is working(FIREFOX,CHROMIUM AND OPERA). But also check it in IE.( I am not a Windows user)





        return false;



Kindly give your feedback.

Thank you for fast and professional answer , It’s working on all browsers even IE .

[color="#006400"]/* moved from General Discussion */[/color]