在CGridView中配置’ajaxUpdate’=>false,采用非ajax来删除一条数据,在CButtonColumn中的删除按钮在IE8下不起作用,但是在火狐和谷歌浏览器上可以删除一条数据,不知道是什么原因,哪位知道是什么原因吗?
代码:
controller:
public function actionDelete()
{
if(Yii::app()->request->isPostRequest){
$id = $_GET['id'];
if($id == NULL){
throw new CHttpException(404,'The requested page does not exist.');
}else{
$model = Personal_info::model()->findByPk($id);
$username = $model->personal_info_username;
Personal_info::model()->deleteByPk($id);
Object::model()->deleteAllByAttributes(array('personal_info_username'=>$username));
if(!isset($_GET['ajax'])){
$this->redirect(array('admin/index'));
}
}
}
}
view:
'class'=>'CButtonColumn',
'header'=>'用戶執行',
'headerHtmlOptions'=>array('width'=>'80px'),
'deleteButtonLabel'=>'删除',
'deleteConfirmation' =>'您確定要刪除該條記錄嗎?',
'updateButtonLabel'=>'更新',
'updateButtonUrl'=>'Yii::app()->createUrl("admin/update", array("id"=>$data->personal_info_id, "flag"=>1))',
'viewButtonLabel'=>'瀏覽',
'viewButtonUrl'=>'Yii::app()->createUrl("admin/view", array("id"=>$data->personal_info_id, "flag"=>0))',
在最新1.1.4中的demo中的blog也测试了下,设置'ajaxUpdate'=>false后,在IE8中也不可以删除一条数据