Yii Framework Forum: Colorbox Extension (Jcolorbox): Problem With Grid Ajax Calls Within Colorbox, It Posts Back - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Colorbox Extension (Jcolorbox): Problem With Grid Ajax Calls Within Colorbox, It Posts Back Rate Topic: ****- 1 Votes

#1 User is offline   mshakeel 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 04-January 13

Posted 01 February 2013 - 01:27 AM

I have used a colorbox extension to display a grid which renders through a separate view. Following is a link code to open colorbox popup:

<?php echo CHtml::link("Log link", array("forecast/log", "id"=>"51"), array("class"=>"smallButton colorBox")); ?>


Following is the code how I bind the colorbox with link:

//Create an instance of ColorBox
$colorbox = $this->widget('application.extensions.colorpowered.JColorBox');
//Call addInstance (chainable) from the widget generated.
$colorbox->addInstance('.colorBox', array('maxHeight'=>'80%', 'maxWidth'=>'90%'));


Action "forecast/log" partially renders a view which contains a grid widget. Following is the log view code

<?php
$this->pageHeading = 'Log';
?>
<div id="page_grid_unit">
    <?php
    $gridView = $this->widget('zii.widgets.grid.CGridView', array(
        'id'=>'grdProjectionsLog',
        'dataProvider'=>$dataProvider,
        'template'=>'{items}{summary}',
        'cssFile' => Yii::app()->baseUrl . '/css/grid/gridView.css',
        'htmlOptions' => array('style' => 'width:99%;'),
        'columns'=>array(
            array(
                'header' => 'Company',
                'name'=>'company.name',
                'headerHtmlOptions'=>array('style'=>'width:300px;'),
            ),
            array(
                'name'=>'modified_at',
            ),
        ),
    ));
    ?>
</div>


Problem:
The colorbox works perfectly fine to show the grid within itself but when we sort the grid which triggers a ajax call to load it again, the page is completely post back and grid does not being refreshed within colorbox.
0

#2 User is offline   mshakeel 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 04-January 13

Posted 01 February 2013 - 05:51 AM

Fixed (Solution):

This is achieved by setting iframe property of colorbox to true. Following is the code:

$colorbox->addInstance('.colorBox', array('iframe'=>true, 'width'=>'80%', 'height'=>'80%'));
// Just set iframe property to true

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users