2013-12-18 29 views
0

在我的web應用程序中,我需要使用quickdlgs創建一個iframe按鈕來創建新記錄。但是當我點擊我框架按鈕時,我沒有得到'創建'網頁,但我得到一個空的iframe。 的控制器Yii使用quickdlgs在CGrid視圖中創建新記錄

public function actionCreate() 
    { 
    $model=new Store; 
     // Uncomment the following line if AJAX validation is needed 
     // $this->performAjaxValidation($model); 
     if(isset($_POST['Store'])) 
     { 
      $model->attributes=$_POST['Store']; 
      if($model->save()) 
      { 
       EQuickDlgs::checkDialogJsScript(); 
      $this->redirect(array('admin')); 
      } 
      $this->redirect(array('view','id'=>$model->id)); 
       EQuickDlgs::render('create',array('model'=>$model)); 
      // $this->redirect(array('create')); 

} 
} 

我的視圖代碼我actionCreate代碼的iframe

<?php 
EQuickDlgs::iframeButton(
    array(
     //'id' =>'create', 
     // 'renderOpenButton' => false, 
     'controllerRoute' => 'create', 
     //'url' =>'/store/create', 
     'dialogTitle' => 'Create Store', 
     'dialogWidth' => 500, 
     'dialogHeight' => 500, 
     'openButtonText' => 'Create new', 
     'closeButtonText' => 'Close', 
     //'closeOnAction' => true, //important to invoke the close action in the actionCreate 
     'refreshGridId' => 'store-grid', //the grid with this id will be refreshed after closing 
    ) 
); 
?> 

這段代碼我已經寫在admin.php的視圖頁面。但是當我點擊iframe按鈕時,我得到一個空的iframe而不是創建按鈕。任何機構善意幫助我。

回答

1

該行EQuickDlgs::render('create',array('model'=>$model));應該在if的範圍之外。

+0

它的工作。我得到了輸出.thks ..但是,在我使用其他按鈕,如編輯或刪除,然後使用創建,我需要刷新頁面,再次使用創建按鈕。你能幫我解決這個問題嗎? – user2492854