2013-12-20 2 views
0

Im пытается закрыть CJuiDialog в успехе Ajax, но его не закрываем, только содержимое Iframe очищается всплывающее окно не закрывается,CJuiDialog не приближались успеха Ajax

CJuiDialog Кодирование:

<?php 
$this->beginWidget('zii.Widgets.jui.CJuiDialog',array(
'id'=>'Document-Edit', 
'options'=>array(
    'title'=>'Manage Documents', 
    'autoOpen'=>false, 
    'modal'=>true, 
    'width'=>800, 
    'height'=>600, 
// 'close'=>'js:function(e,o){location.reload();}' , 
), 
)); 
?> 
<iframe id="cru-frame-doc" width="100%" height="100%" frameBorder="0" scrolling="no" > 
<?php $this->renderPartial('ManageDocuments_Update', array('model'=>$model)); ?> 
</iframe> 


<?php $this->endWidget();?> 

CGridView Код:

<?php $this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'document-grid', 
    'dataProvider'=>$model->search(), 
    'columns'=>array(
    array(
         'class' => 'CButtonColumn', 
         'template' => '{DocumentEdit}', 
         'buttons' => array(

          'DocumentEdit' => array(
          'imageUrl'=>Yii::app()->request->baseUrl.'/images/update.png', 
            'url'=>'$this->grid->controller->createUrl("DocumentEdit", array("id"=>$data->crm_document_id,"asDialog"=>1))', 

            'click'=>'function(){ 

            $("#cru-frame-doc").attr("src",$(this).attr("href")); $("#Document-Edit").dialog("open"); return false;}', 

          ), 
        ),), 
     'crm_document_id', 
     'name', 
     'doc_type', 
     'delivery_method', 
     'content_subject', 
     'content_body', 
     'is_active', 

    ), 

)); ?> 

Ajax Submit Кнопка Код:

<?php 
    echo CHtml::ajaxSubmitButton('Save', 
    'js:document.location.href='.'"'.Yii::app()->createUrl("baseContact/SaveManageDocuments_Update",array("id" => $model->crm_document_id)).'"', 
    array( 
    'type'=>'POST', 
    "dataType" => "json", 

    'success' => 'function(data){ 

     if(data.result=="success"){ 
    window.parent.$("#Document-Edit").dialog("close"); 
    window.parent.$("#cru-frame-doc").attr("src",""); 

     } 
    }', 

    )); 
    ?> 

Можно ли указать, где им сделать ошибку ...

ответ

0

Используйте следующий код в действии SaveManageDocuments_Update контроллера, чтобы закрыть диалоговое окно,

echo CHtml::script("window.parent.$('#Document-Edit').dialog('close');window.parent.$('#cru-frame-doc').attr('src',''); window.parent.$.fn.yiiGridView.update('document-grid');"); 
       Yii::app()->end(); 
Смежные вопросы