How to include a fancybox in CGridview

How to implement the Fancy box in CGridView.Can anyone help me?

I have implemented fancy box in my project, below is the example code to implement fancy box in CGridView




<?php 

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

	'id'=>'stay-details-grid',

        // Here we need to mention js fancy box function to work in after ajax calling

	'afterAjaxUpdate'=>"function(id,data){ $('a[rel=viewtravel]').fancybox({

				'transitionIn'		: 'none',

				'transitionOut'		: 'none',

				'titlePosition' 	: 'outside',

				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {

					return '<span id=\"fancybox-title-over\">Accommodation Details ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';

				}

	}); }",

	'dataProvider'=>$model->search(),

	//'filter'=>$model,	

	'columns'=>array(

		array(

		'header'=>'First Name',

		'value'=>'$data->User->user_firstname',

		'name'=> 'firstname',

		'sortable'=>TRUE,

		),

		array(

		'header'=>'Last Name',

		'value'=>'$data->User->user_lastname',

		'name'=> 'lastname',

		'sortable'=>TRUE,

		),		

		array(

		'header'=>'Country',

		'value'=>'$data->StayCountry->location_name',

		'name'=>'staycountry',

		'sortable'=>TRUE,

		),

		array(

		'header'=>'City',

		'value'=>'$data->StayCity->location_name',

		'name'=>'staycity',

		'sortable'=>TRUE,

		),		

		'td_stay_checkIn_date',

		'td_stay_checkOut_date',

		array(

			'class'=>'CButtonColumn',

			'header'=>'Actions',

			'template'=>'{view}',	

			'buttons'=>array

			(

				'view' => array

				(

					'label'=>'View',

					'options'=>array('rel'=>'viewtravel','class'=>'fancy'),

					'url'=>'Yii::app()->createUrl("stayDetails/view",array("id"=>$data->id))',

				),

			),					

		),

	),

)); 

?>


</div>


<script type="text/javascript">

<!--

$(document).ready(function() {

$("a[rel=viewtravel]").fancybox({

				'transitionIn'		: 'none',

				'transitionOut'		: 'none',

				'titlePosition' 	: 'outside',

				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {

					return '<span id="fancybox-title-over">Accommodation Details ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';

				}

			});

});

-->

</script>



First question:

Is this related to Yii 1.0 or Yii 1.1 ?

Second question:

Why is it so hard to enclose your code in code tags?

Thanks. ;)

Obviously it is related to Yii 1.1, because CGridView is available since 1.1 version, so I move this topic ;)

Also I hope people will read your message and start to use [ code ] tags, because without them a code is simply unreadable.