2

I had an issue with Yii subgrid, when i add some data and submit the page. The page reloads and after that when i check the subgrid it is not listing the data i actually added there, i had this issue only with IE 9. In all other browsers like Chrome, Firefox it works perfect.

Am not sure why it happens so i clear the cache and checked but still having that issue. And i noticed that the issue is because IE it is not calling the ajax to load that subgrid once the whole site is refreshed. Any one please help me to sort this issue..

Here is the code:

index.php

 <div class="span9 search-results">
    <?php
        /* @var $this CVController */
        $this->breadcrumbs = array(
        'C V',
        );
        $flashMessages = Yii::app()->user->getFlashes();
        $gridDataProvider = new CArrayDataProvider($cvs, array(
        'keyField' => 'id',
        'sort' => array('attributes' => array('name'),), 'pagination' => array('pageSize' => 20)
    ));

    $user = Yii::app()->user;

    if ($user->accessFeature()) {

        $this->widget('bootstrap.widgets.TbButton', array(
            'label' => Yii::t('main', 'ADD_CV'),
            'type' => 'secondary',
            'size' => 'small',
            'url' => Yii::app()->controller->createUrl("cV/addHeader")
        ));
        ?>&nbsp;<?php
        $this->widget('bootstrap.widgets.TbButton', array(
            'label' => Yii::t('main', 'CV_LIST'),
            'type' => 'secondary',
            'size' => 'small',
            'url' => Yii::app()->controller->createUrl("list/index")
        ));
        ?>&nbsp;<?php
        $this->widget('bootstrap.widgets.TbButton', array(
            'label' => Yii::t('main', 'ARCHIVED_CV_LIST'),
            'type' => 'secondary',
            'size' => 'small',
            'url' => Yii::app()->controller->createUrl("list/showArchiveCv")
        ));
    }
    $gridColumns = array(
        array(
            'name' => 'name',
            'class' => 'bootstrap.widgets.TbRelationalColumn',
            'url' => $this->createUrl('interviewProcess/getScheduledInterviews'),
            'header' => Yii::t('main', 'CANDIDATE_NAME'),
        ),
        array(
            'name' => 'clname',
            'header' => Yii::t('main', 'COUNTRY'),
            'value' => '$data["city"] != "" ? $data["clname"].", ".$data["city"] : $data["clname"]',
        ),
        array(
            'name' => 'header_availability',
            'header' => Yii::t('main', 'AVAILABILITY'),
        ),
        array(
            'name' => 'header_cv_verified',
            'header' => Yii::t('main', 'VERIFIED_LABEL'),
            'value' => '$data["header_cv_verified"] == 1 ? "' . Yii::t('main', 'VERIFIED_LABEL') . '" : "' . Yii::t('main', 'NOT_VERIFIED_LABEL') . '"',
            'type' => 'raw',
            'cssClassExpression' => '$data["header_cv_verified"] == 1 ? "verified" : "notverified"',
        ),
        array(
            'htmlOptions' => array('nowrap' => 'nowrap'),
            'template' => '{view} {download}{file_download}',
            'class' => 'bootstrap.widgets.TbButtonColumn',
            'viewButtonUrl' => "Yii::app()->controller->createUrl('preview/cv',array('id'=> " . '$data' . "['id']))",
            'buttons' => array(
                'download' => array(
                    'label' => Yii::t('main', 'BRIDGE_CV_DOWNLOAD'),
                    'url' => "Yii::app()->controller->createUrl('preview/createPdf',array('id'=> " . '$data' . "['id']))",
                    'icon' => 'icon-download'
                ),
                'file_download' => array(
                    'label' => Yii::t('main', 'CV_DOWNLOAD'),
                    'url' => "Yii::app()->controller->createUrl('downloadCv',array('id'=> " . '$data' . "['id']))",
                    'icon' => 'icon-download-alt'
                ),
            ),
        ),
        array(
            'htmlOptions' => array('data-toggle' => 'modal', 'data-target' => '#setInterviewForm'),
            'template' => '{set_interview}',
            'class' => 'bootstrap.widgets.TbButtonColumn',
            'buttons' => array(
                'set_interview' => array(
                    'label' => Yii::t('main', 'SET_INTERVIEW'),
                    'icon' => 'th-list',
                    'class' => "btn btn-small",
                    'data-target' => "#setInterviewForm",
                    'url' => "Yii::app()->controller->createUrl('interviewProcess/index',array('id'=> " . '$data' . "['id']))",
                    'data-toggle' => "modal",
                ),
            ),
        ),
        array(
            'htmlOptions' => array('data-toggle' => 'modal', 'data-target' => '#addCandidateDescription'),
            'template' => '{verify}',
            'class' => 'bootstrap.widgets.TbButtonColumn',
            'buttons' => array(
                'verify' => array(
                    'label' => Yii::t('main', 'VERIFY_THIS_CANDIDATE'),
                    'visible' => 'CandidateInterviewSkillRate::model()->checkIfVerifyable($data)',
                    'url' => "Yii::app()->controller->createUrl('interviewProcess/index',array('id'=> " . '$data' . "['id']))",
                    'data-target' => "#addCandidateDescription",
                    'data-toggle' => "modal",
                    'class' => "btn btn-small",
                    'icon' => 'ok',
                ),
            )
        )
    );







//Yii booster to show the CV list
    ?>


<div id="result_div">



    <?php
    $this->widget('bootstrap.widgets.TbGridView', array(
        'type' => 'striped bordered',
        'dataProvider' => $gridDataProvider,
        'template' => "{items}",
        'responsiveTable' => true,
        'columns' => $gridColumns,
    ));
    ?>





    </div>



</div>

getScheduledInterviews.php

<?php

$gridColumns = array(
    array(
        'name' => 'interview_type',
        'header' => Yii::t('main', 'INTERVIEW_TYPE'),
        'value' =>  array($this, 'getInterviewType'),
    ),
    array(
        'name' => 'interviewers',
        'header' => Yii::t('main', 'INTERVIEWERS'),
        'value' =>array($this, 'getInterviewers'),
    ),
    array(
        'name' => 'interview_date',
        'header' => Yii::t('main', 'INTERVIEW_DATE_TIME'),
        'value' =>array($this, 'getInterviewDate'),
    ),

    array(
        'htmlOptions' => array('nowrap' => 'nowrap'),
        'template' => '{delete}{success}{view_rating}',
        'class' => 'bootstrap.widgets.TbButtonColumn',
        //'deleteButtonUrl' => "Yii::app()->controller->createUrl('interviewProcess/delete',array('id'=> " . '$data' . "['id']))",
        'buttons' => array(
            'delete' => array(
                'label'=>Yii::t('main', 'DELETE_INTERVIEW'),
                'visible' => 'InterviewProcessController::checkInterviewStatus($data,1)',
                'icon' => 'icon-trash',
                'url' =>  "Yii::app()->controller->createUrl('interviewProcess/delete',array('id'=> " . '$data' . "['id']))",
            ),
            'success' => array(
                'label'=>Yii::t('main', 'INTERVIEW_COMPLETED'),
                'visible' => 'InterviewProcessController::checkInterviewStatus($data,2)',
                'icon' => 'icon-ok',
                'url' =>  "Yii::app()->controller->createUrl('interviewProcess/completed',array('id'=> " . '$data' . "['id']))",
            ),
            'view_rating' => array(
                'label'=>Yii::t('main', 'VIEW_RATING'),
                'visible' => 'InterviewProcessController::checkInterviewStatus($data,3)',   
                'icon' => 'icon-star',
                'url' => "Yii::app()->controller->createUrl('interviewProcess/viewrating',array('id'=> " . '$data' . "['interview_schedules_id']))",
            ),
        ),

    ),
);


?>

<?php
$this->widget('bootstrap.widgets.TbGridView', array(
'id' => 'interview-list-' . $_GET['id'],
'type' => 'striped bordered',
'enableSorting' => false,
'dataProvider' => $interviews,
'template' => "{items}{pager}",
'responsiveTable' => true,
'columns' => $gridColumns,
));
?>
Sanjay
  • 761
  • 14
  • 25
  • this might help you http://www.igiladera.com/2013/10/yii-custom-refresh-zii-widgets-grid-cgridview-after-updating-database/ – sakhunzai Jan 28 '14 at 05:56
  • Hi thanks for the but the issue is that i had multiple subgrids and am loading the all page after adding new data. And i had the issue only with IE. – Sanjay Jan 28 '14 at 06:14
  • What I think is that the subgrid json data is cached , you have to change the subgrid url once that subgrid is changed/updated e.g by appending an random number. – sakhunzai Jan 28 '14 at 06:17
  • Yes i too think that the data is cached, because there is no ajax call after refresh that page in IE. In other browsers there is an ajax call after refresh the page. I had a random number id for each grid like interview-list-255,interview-list-899 etc so i try the method you suggested also but doesn't solved the issue.One more thing i noticed that when ever i clear cache ,cookie, session etc it doesn't logout me from my application in IE but it logout in all other browsers. – Sanjay Jan 28 '14 at 07:14
  • could you share how subgrid is created ? – sakhunzai Jan 28 '14 at 07:22
  • Hi Sorry for the late replay, i have just added the code of both main listing and the subgrid – Sanjay Jan 28 '14 at 11:42
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/46222/discussion-between-sakhunzai-and-sanjay) – sakhunzai Jan 28 '14 at 11:58
  • sorry Sanjay it seems to be some issue with chat system – sakhunzai Jan 28 '14 at 12:31
  • you should look at this for further customization : http://chris-backhouse.com/yii-how-to-customize-a-cgridview-cbuttoncolumn-part-2/590 – sakhunzai Jan 28 '14 at 12:33

0 Answers0