Thursday, December 22, 2011

Fancy box in CGridView in Yii Framework

$this->widget('zii.widgets.grid.CGridView', array(
 'id'=>'travel-details-grid',
        //here we need to mention the fancy box function after ajax  
 'afterAjaxUpdate'=>"function(id,data){ $('a[rel=viewtravel]').fancybox({
    'transitionIn'  : 'none',
    'transitionOut'  : 'none',
    'titlePosition'  : 'outside',
    'titleFormat'  : function(title, currentArray, currentIndex, currentOpts) {
     return 'Transit Details ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? '   ' + title : '') + '';
    }
 }); }",
 'dataProvider'=>$model->search(),
 //'filter'=>$model,
 'columns'=>array(
  'td_first_name',
  'td_travel_depart_date',
  'td_travel_arrive_date',
  array(
   'class'=>'CButtonColumn',
   'header'=>'Actions',
   'template'=>'{view}', 
   'buttons'=>array
   (
    'view' => array
    (
     'label'=>'View',
     'options'=>array('rel'=>'viewtravel','class'=>'fancy'),
     'url'=>'Yii::app()->createUrl("travelDetails/adminview",array("id"=>$data->id))',
    ),
   ),          
  ),
 ),
)); 

-->

No comments:

Post a Comment