[EXTENSION] quickdlgs

Hi Joblo,

Again, many thanks for a great contribution.

I’ve used your extension in my project and almost everything is working fine.

However, I have encountered an issue while I am trying to implement pagination inside dialog popup.

Ajax does not work inside the dialog, every time i move to next page the dialog popup close and bring me to the main white window.

I attached two images this would explain the cause :)

Thanks in advance for your respond.

Thanks,

pod2g

Hello Joblo,

Plz, ignore my question here, stupid me I forgot to see your note

"You will have problems if you show list, create, update, admin action views inside an ajax-dialog, because the javascript (pagination …) will not work as expected."

I have changed to use iframe-dialog and it works like a charm.

Million thanks for a great extension.

Thanks,

pod2g

Hi there,

I have embedded the extension in a simple widget :

A button and some text.

The button click opens a dialog to update DB (iframeButton).

I want to update the widget content after closing the dialog (like refreshing a Grid) as the widget text content may differ with DB values but without reloading the whole page…

I did not find any solution in any forum.

If you have any clue for me, that could be great !

Many thanks.

PS : I posted also in the general discussion as it could be a more general subject too (Ajax) : http://www.yiiframework.com/forum/index.php/topic/35771-widget-dialog-and-ajax/

You can add a custom js-script as param of the function ‘EQuickDlgs::checkDialogJsScript()’.

This will be executed after dialog close. See the source of checkDialogJsScript().




public function actionUpdate($id)

{

    ....

 

        if(model->save())

        {

            //close the dialog and update the grid instead of redirect if called by the update-dialog


            $customJsScript = "alert('test');window.parent.$('#someelementid').dosomething(); ......";

            EQuickDlgs::checkDialogJsScript($customJsScript);


            $this->redirect(array('admin','id'=>$model->id));

        }

 

        //check if the iframe layout (or renderPartial) has to be used

        EQuickDlgs::render('update',array('model'=>$model));

        //$this->render('update',array('model'=>$model));

}




Dialog for update and delete works.

Having trouble with View from Admin: The DIV id is not getting created for some reason.

Error: TypeError: $("#mygrid_c8viewWdgt-dlg").dialog is not a function

if support the refreshListViewId(refreshListId) it will be better . :lol: although it can achieved this way

Hi,

I’m implementing the iframe dialog to make some action updates.

I want to make actions and re-render the dialog => I want to make ‘steps’ with the same iframe dialog.

Is it possible?

Many thanks

how can i set a dynamic dialog title from dataProvider? ‘dialogTitle’ => ‘$data->name’ dont work.

That EQuickDlgs::checkDialogJsScript($customJsScript); method is in Controller itself.

How could i pass some $data = array(…) from that controller to that $customJsScript ?

I need to update a form dropdown like this:





FORM:


 <?php echo $form->dropDownListRow($model, 'actividad_id',$actividades, 

                                   array(

                                       'style'=>'width:100%;',

                                       'empty'=>'Seleccione Actividad',

                                       'errorOptions'=>array('style'=>'display:none;'),  

                                       'labelOptions'=>array('style'=>'display:none;')

                                   )); ?>

         

                    <?php EQuickDlgs::iframeButton(

                                array(

                                    'controllerRoute' => '/actividades/ajaxCreateFromInteraccion',

                                    'urlParams'=>array('id_proceso'=>$id_proceso, 'ajaxRequest'=>1),

                                    'hideTitleBar' => true,

                                    'dialogTitle' => 'Crear nueva actividad',

                                    'dialogWidth' => 550, 

                                    'dialogHeight' => 335,

                                    'openButtonText' => 'Nueva Actividad',

                                    'closeButtonText' => 'Cerrar',

                                    'closeOnAction' => true, //important to invoke the close action in the 

          

                                ) 

                            );

                   ?>

 

CONTROLLER ACTION:


  public function actionAjaxCreateFromInteraccion($id_proceso=null)

	{

              if(isset($_GET['ajaxRequest']) && $_GET['ajaxRequest']== 1){

                  

                    $model=new Actividades;

                    $model->proceso_id = $id_proceso;


                    if(isset($_POST['Actividades']))

                    {

                            $model->attributes=$_POST['Actividades'];


                            if($model->save(false)){

                                

                                $criteria = new CDbCriteria;

                                $criteria->select = 'id_actividades, name'; 

                                $criteria->addCondition('proceso_id ='.$id_proceso);


                                $actividades = CHtml::listData(Actividades::model()->findAll($criteria), 'id_actividades', 'name');

  

                                echo CJSON::encode($actividades); //DATA I WANT TO PASS TO FORM

                                                


                                 EQuickDlgs::checkDialogJsScript(-------- ? ----------);


                            }


                    }   

    

                        EQuickDlgs::render('_create',array('model'=>$model));


	 }else

			throw new CHttpException(400,'Accion invalida. No la intente de nuevo.'); 

                    

                    

         }

                




I tried:





 EQuickDlgs::checkDialogJsScript("

                                    window.parent.$('#Interacciones_actividad_id').val(data);  

     

                                ");




But i get : "data is not defined" firebug msg.

Ty, for your answer.

If you didn’t already solved your problem…

You don’t need to refresh the entire dropdownlist just add the newly added row to it using jquery.




$seleNew= CHtml::tag('option',array ('value'=>$model->id, 'selected'=>true),CHtml::encode($model->name),true);

$customJsScript = "window.parent.$('#YOURSDROPDOWNLISTID').append('".$seleNew."');";

EQuickDlgs::checkDialogJsScript($customJsScript);



AutoClose of dialog does not work when redirected.

I display a update-view (update form) using EJuiDialogsColumn in CGridView on a admin page.

On this update-form I created a button that sends a request to copy and delete something and then redirects the user to another form that shows the result of the manipulations and lets the user change something manually.

This new page is of course displayed inside the JQuery UI dialog box. I can edit the data and save them, that works, but:

After I click on the Save-button of this form the dialog is not automatically closed and the CGridView on the parent window does not refresh.

I have to close the dialog manually and I must reload the parent window manually (F5).

Please can somebody give me a hint how to solve this.

Now I found a solution:

I added JavaScript Code to the saveButton of the form displayed in the dialog.

I looked for the id of the dialog and used it to close the dialog:


$url = Yii::app()->createAbsoluteUrl('sammelhefte/admin');

Yii::app()->clientScript->registerScript('save',"

    $('#submitButton').click(function() {

        window.top.jQuery('#sammelhefte-grid_c8updateWdgt-dlg').dialog('close');

        // window.top.$.fn.yiiGridView.update('sammelhefte-grid');

        window.top.location.href='".$url."';

    });",CClientScript::POS_READY);



Now the dialog is closed after click on the save Button and I get redirected but the changes on the current record are not saved.

Therefore I give it up … :-[

Hello. Someone Knows some extension like this for Yii 2? Thanks