Sunday, February 16, 2014

CGridView and show detail in CJuiDialog

$this->widget('zii.widgets.grid.CGridView', array(
     .....
     'columns' => array(
         ....
         array(
             'class' => 'CButtonColumn',
             'buttons' => array(
                 'view' => array(
                     'url' => 'url' => 'Yii::app()->createUrl("/path/to/controller/view")',
                     'options' => array(
                         'ajax' => array(
                             'type' => 'POST',
                             'url' => "js:$(this).attr('href')",
                             'update' => '#detail-section',
                         ),
                     ),
  
                 ),    // view button
             ),
         ),
     )
 ));
$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
         'id' => 'dlg-detail',
         'options' => array(
             'title' => 'Dialog Box Title',
             'closeOnEscape' => true,
             'autoOpen' => false,
             'model' => false,
             'width' => 550,
             'height' => 450,
         ),
 ));
<div id="detail-section"></div>
 $this->endWidget();

No comments:

Post a Comment