当我添加一些数据并提交页面时,我遇到了Yii subgrid的问题。页面重新加载,之后当我检查子网格时它没有列出我实际添加的数据,我只在IE 9中遇到此问题。在Chrome,Firefox等所有其他浏览器中,它的工作非常完美。
我不确定为什么会这样,所以我清除缓存并检查但仍然遇到了这个问题。我注意到问题是因为IE在刷新整个站点时没有调用ajax加载该子网格。请帮助我解决这个问题..
以下是代码:
的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")
));
?> <?php
$this->widget('bootstrap.widgets.TbButton', array(
'label' => Yii::t('main', 'CV_LIST'),
'type' => 'secondary',
'size' => 'small',
'url' => Yii::app()->controller->createUrl("list/index")
));
?> <?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,
));
?>