Topic for the extension quickdlgs.
Topic for the extension quickdlgs.
Hi,
Getting following error when using in modules
Unable to resolve the request "project/index.php?r=customer/subscribergroups/create?qdsClass=EAjaxJuiDlg".
My Code is
EQuickDlgs::ajaxButton(
array(
'controllerRoute'=>'customer/subscribergroups/create',
'dialogTitle' => 'Add Group',
'dialogWidth' => 800,
'dialogHeight' => 600,
'openButtonText' => 'Add New Group',
'closeButtonText' => 'Close',
'closeOnAction' => true, //important to invoke the close action in the actionCreate
'refreshGridId' => 'groups-grid', //the grid with this id will be refreshed after closing
)
);
?>
Any help?
More over when I use it with URL, then it works but after performing action, it does not return to the parent page
Got Solution and posted here in Extension Comments
Thanks.
I will fix this in the next release.
I didn’t thought about the Yii url ‘?r=…’ because I always have the urlManager enabled.
Hello joblo and thank you for a great extension!
I am having problems creating an item in another model and then adding said item to original dropdown list.
Here is my setup:
I have a Content page with a Create Content form on it.
This form has a Content Type dropdown which is populated from the ContentType module.
Then I have a "+" icon next to the Content Type dropdown that opens up the dialog (this is your extension at work)
It works fine in adding the new Content Type item to the module however the problem is that I don’t know how to refresh the Content Type dropdown in the original page without refreshing the page?
Can you please give me a hint how to do this?
Thank you in advance!
P.S.
I did not use the iframeIcon instead of the ajaxIcon because the iframe method gives me a very short iframe which looks bad and I could not figure out how to fix it.
EDIT:
I have found another simpler way to do this: http://www.yiiframework.com/wiki/145/cjuidialog-for-create-new-model/
I have yet to implement it but I will post back if I’m successful Thanks!
Love this extension, just what I need to simplfy CRUD operations in my current project. I have come across a problem that has me stymed for the moment and I was hoping someone could point me in the right direction.
When I’ve created an EQuickDlgs::iframeLink everything has worked as expected, however the content of the Iframe is stuck in small box in the top of the dialog with a scroll bar. There is plenty of room to display the full content however it frustratingly stays fixed in that one small div at the top of the iframe.
I’ve tracked the culpruit down to the following html code that is rendered by the extension.
<div id="yw0-content" style="">
If I manualy change the style to "height: 100%" using firebug then the iframe behaves as I would expect.
where can I set this style to display the full view content properly in the iFrame?
Very useful extension, but has anyone tried to combine quickdlds (EJuiDlgsColumn) with GroupGridView?
Ok I’ve found a solution, let me know if anyone else has a better one.
I’ve modified the EBaseJuidlg.php file to include the style parameter. I’ve added the following code after line 388.
$htmlOptions['style'] = "height: 100%;";
The renderDialog function now reads like
public function renderDialog()
{
$this->beginWidget('zii.widgets.jui.CJuiDialog', $this->getDialogAttributes());
//render the container
$htmlOptions = $this->contentWrapperHtmlOptions;
$htmlOptions['id'] = $this->getContentWrapperId();
$htmlOptions['style'] = "height: 100%;";
Hi joblo,
Many thanks for you nice contribution.
However, i have an issue while trying to use dialog in CGridView:
$this->widget(‘zii.widgets.grid.CGridView’, array(
'dataProvider'=>$dataProvider,
'columns'=>array(
array( 'name' => 'name',
'value' => 'EQuickDlgs::iframeLink(
array(
"controllerRoute" => "view",
"actionParams" => array("id"=>$data->building_id),
"openButtonText" => "$data->name",
"dialogTitle" => "Detail view")
)',
),
When i navigate to 2nd pagination and i try to view the dialog in display inline in CGrid view not popup.
I got no issue every time i refresh the page or i am at first page of navigation.
Thanks,
pod2g
I have never tried this, because it’s a tool for opening a dialog.
If you want to display a view in a grid column you can try this: complex datacolums: section C)
Hi joblo,
Thanks for your respond.
Apologize, maybe my explanation is not clear.
picture means a thousand words, i attached two picture here one is a working (popup display) , another one is not working (not popup display embeded/inline in view).
You’re right the tool use to display opening dialog that what i need. However here it does not pop up.
Thanks,
pod2g
Hi,
I try to find a solution to use the Dialog buttons to submit my form on update using EJuidlgsColumns.
It’s more ‘user friendly’ for me to have the buttons at the bottom of the dialog rather than in the iframe.
I know how to display them but no idea on how to do the same actions like buttons in iframe.
If you have some code…
Many thanks for your help
Hello,
This looks like a great extension - thanks so much for your work! I’m having a problem adding a ajaxIcon to a CGridview in yii 1.11. I add the icon using:
$custProvider = new CActiveDataProvider('Customer', array(
'criteria'=>array(
'condition'=>'deleted_td=\'0000-00-00 00:00:00\'',
'order'=>'company_name ASC',
//'with'=>array('author'),
),
'pagination'=>array(
'pageSize'=>50,
),
));
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'customer-grid',
'dataProvider'=>$custProvider,
//'filter'=>$model,
'columns'=>array(
//'id',
'company_name',
'description',
//'gid',
'phone',
//'deleted_td',
'supportplan',
array(
'class'=>'CButtonColumn',
),
array(
'name'=>'',
//'header'=>'Action',
'type'=>'raw',
'value'=>'EQuickDlgs::ajaxIcon(
Yii::app()->baseUrl .\'/images/update.png\',
array(
\'controllerRoute\' => \'customer/update\',
\'actionParams\' => array(\'id\'=>$data["id"]),
\'dialogTitle\' => \'Update Customer\',
\'dialogWidth\' => 800,
\'dialogHeight\' => 600,
\'openButtonText\' => \'Update\',
\'closeButtonText\' => \'Close\',
\'refreshGridId\' => \'customer-grid\',
)
);'
),
),
));
It renders as expected and triggers the modal but as soon as I add the following to actionUpdate in the controller:
if($model->save())
{
//close the dialog and update the grid instead of redirect if called by the update-dialog
EQuickDlgs::checkDialogJsScript();
$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,));
It no longers renders the update view in the modal. If I change this back to $this->render(‘update’,array(‘model’=>$model,)) it renders the view at least but it has the entire site in the modal view, not just the update form. Am I missing something?
Thanks in advance for any clues!
EDIT
I grabbed a new 1.12 (just released!) and added the extension and then used my code from above and everything worked UNTIL I added the following code to actionUpdate:
if($model->save())
{
//close the dialog and update the grid instead of redirect if called by the update-dialog
EQuickDlgs::checkDialogJsScript();
$this->redirect(array('admin','id'=>$model->id));
}
If this code is present then the modal window does NOT paint the view in 1.11 or 1.12. Also for what its worth I’m putting a CGridView in index.php as opposed to the default CListView that is stubbed out by gii but it has the same issue if the code is placed in admin.php.
Am I missing something?
After re-reading the extention instructions it seems as though this is because I’m trying to do an ajax modal dialog instead of an iframe (the goal being to update the selected row).
I’m now attempting to use iframe for the update.
EDIT: grammar/spelling
Hi thanks for this great extension.
I’m having the same problem pod2g described.
It seems like after an ajax update on a CGridView, if we try to open a dialog from inside the grid, the dialog will show inline above the clicked link or button instead of popup.
After some fooling around (fixing the location of EQuickDlgs::checkDialogJsScript(); in the control actions) and changing out my raw button behavior above for EJuiDlgsColumn in the CGridView:
array(
'class'=>'EJuiDlgsColumn',
'template'=>'{update}',
'updateButtonImageUrl'=>Yii::app()->baseUrl .'/assets/72ec0933/gridview/update.png',
'updateDialog'=>array(
'controllerRoute' => 'update',
'actionParams' => array('id'=>'$data->id'),
'dialogTitle' => 'Update Customer',
'dialogWidth' => 800, //override the value from the dialog config
'dialogHeight' => 600,
'closeButtonText' => 'Close',
'closeOnAction' => true,
'refreshGridId' => 'customer-grid'
),
),
),
Everything is working swimmingly for me in 1.12. Thank you so much for a great extension! I’ll be upvoting when it unlocks!
Cheers!
I had this issue as well - the solution was to make sure that the model->save() code from the instructions is added to the existing $model->save() block stubbed out by Gii. For example:
Controller:
public function actionUpdate($id)
{
$model=$this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Customer']))
{
$model->attributes=$_POST['Customer'];
if($model->save()) {
EQuickDlgs::checkDialogJsScript();
//$this->redirect(array('view','id'=>$model->id));
$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,));
}
Also make sure you tell the view which grid to update and set close on action to true.
I hope that helps!
Hello,
I use this extension, and with the bug correction of url, ajaxIcon work well. But when I try to use EJuiDlgsColumn don’t work.
In the controller can’t use renderPartial (the frame is in white), and when put render the view is complete but with the header and footer.
Front view
<?php
if ($model->id) {
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'presupuestospedido-grid',
'dataProvider'=>$dataProvider,
'columns'=>array(
array(
'header'=>'Proveedor',
'value'=>'Proveedores::model()->findByPk($data->Proveedores_idProveedores)->proveedor'
),
'Fecha',
'NumOfer',
array(
'header'=>'Importe neto',
'class'=>'ImportePresupuestoColumn',
),
array(
'class'=>'EJuiDlgsColumn',
'template'=>'{update}{delete}',
'buttons'=>array(
'delete'=>array(
'url'=>'Yii::app()->createUrl(
"/presupuestos/delete",
array("id"=>"$data->id"))',
),
),
'updateDialog'=>array(
'dialogTitle'=>'Actualiza Pieza',
'controllerRoute'=>'presupuestos/actualizar',
'actionParams'=>array('id'=>'$data->id','pedido'=>$model->id),
'closeOnAction'=>true,
'refreshGridId'=>'presupuestospedido-grid',
),
),
),
));
EQuickDlgs::ajaxIcon(Yii::app()->baseUrl .'/images/Iconos/Function/add_48.png',
array(
'controllerRoute'=>'presupuestos/crear',
'actionParams'=>array('pedido'=>$model->id,'basura'=>1),
'dialogTitle'=>'Nuevo Presupuesto',
'dialogWidth'=>800,
'dialogHeight'=>600,
'openButtonText'=>'Añadir Presupuesto',
'closeButtonText'=>'Cerrar',
'closeOnAction'=>true,
'refreshGridId'=>'presupuestospedido-grid',
)
);
}
?>
Controller:
public function actionCrear($pedido,$basura)
{
$model=new Presupuestos;
if (isset($_POST['Presupuestos']))
{
$model->attributes=$_POST['Presupuestos'];
if ($model->save())
{
$Pedidos_Pre=new PedidosPresupuestos;
$Pedidos_Pre->Pedidos_id=$pedido;
$Pedidos_Pre->Presupuestos_id=$model->id;
$Pedidos_Pre->save();
$c=new CDbCriteria();
$c->condition='Pedidos_id=<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/tongue.gif' class='bbc_emoticon' alt=':P' />_id';
$c->params=array('<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/tongue.gif' class='bbc_emoticon' alt=':P' />_id'=>$pedido);
$piezas=PedidosPiezas::model()->findAll($c);
foreach ($piezas as $p)
{
$Pre_pie=new PresupuestosPiezas;
$Pre_pie->Inventario_idInventario=$p->Inventario_idInventario;
$Pre_pie->Cantidad=$p->Cantidad;
$Pre_pie->Presupuestos_id=$model->id;
$Pre_pie->save();
}
EQuickDlgs::checkDialogJsScript();
$this->redirect(array('pedidos/actualiza','id'=>$pedido));
}
}
EQuickDlgs::render('_form',array('model'=>$model,'pedido'=>$pedido));
}
public function actionActualizar($id,$pedido)
{
$model=$this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
$c=new CDbCriteria;
$c->condition='Presupuestos_id=<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/tongue.gif' class='bbc_emoticon' alt=':P' />_id';
$c->params=array('<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/tongue.gif' class='bbc_emoticon' alt=':P' />_id'=>$model->id);
$dataProvider=new CActiveDataProvider('PresupuestosPiezas',array('criteria'=>$c));
if(isset($_POST['Presupuestos']))
{
$model->attributes=$_POST['Presupuestos'];
if($model->save()) {
EQuickDlgs::checkDialogJsScript();
$this->redirect(array('pedidos/actualizar','id'=>$pedido));
}
}
//$this->renderPartial('_form',array('model'=>$model,'pedido'=>$pedido));
EQuickDlgs::render('_form', array('model'=>$model,'pedido'=>$pedido,'dataProvider'=>$dataProvider));
}
If I use something like that:
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'piezaspedido-grid',
'dataProvider'=>$dataProviderPiezas,
'columns'=>array(
array(
'header'=>'pieza',
'value'=>'Inventario::model()->findByPk($data->Inventario_idInventario)->pieza'
),
'Cantidad',
array(
'class'=>'CButtonColumn',
'template'=>'{update}{delete}',
'buttons'=>array(
'update'=>array(
'url'=>'EQuickDlgs::ajaxIcon(
Yii::app()->baseUrl."/images/Iconos/Led/application_edit.png",
array(
"controllerRoute"=>"pedidosPiezas/actualiza",
"actionParams"=>array("id"=>$data->id,"pedido"=>'.$model->id.'),
"dialogTitle"=>"Modificar",
"dialogWidth"=>800,
"dialogHeight"=>600,
"openButtonText"=>"Modificar",
"closeButtonText"=>"Cerrar",
"closeOnAction"=>true,
"refreshGridId"=>"piezaspedido-grid",
)
);'
),
'delete'=>array(
'url'=>'Yii::app()->createUrl(
"/pedidosPiezas/delete",
array("id"=>"$data->id"))',
),
),
),
),
));
The renderPartial work, but it don’t look good.
I try to put EQuickDlgs::ajaxIcon inside other EQuickDlgs, and don’t work fine. The element’s parent dialog is:
<img onclick="yw6Ajax();$('#yw6-content').show();$('#yw6-dlg').dialog('open');return false;" style="cursor:pointer;" src="/yiitest/images/Iconos/Led/application_edit.png" alt="Actualizar Presupuesto">
And child dialogue
<div style="display: block; z-index: 1002; outline: 0px; position: absolute; height: auto; width: 800px; top: 405px; left: 228.5px; " class="ui-dialog ui-widget ui-widget-content ui-corner-all yw6-dlg ui-draggable ui-resizable" tabindex="-1" role="dialog" aria-labelledby="ui-dialog-title-yw6-dlg"><div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"><span class="ui-dialog-title" id="ui-dialog-title-yw6-dlg">Actualizar Presupuesto</span><a href="#" class="ui-dialog-titlebar-close ui-corner-all" role="button"><span class="ui-icon ui-icon-closethick">close</span></a></div><div id="yw6-dlg" style="width: auto; min-height: 0px; height: 481.83333349227905px; " class="ui-dialog-content ui-widget-content" scrolltop="0" scrollleft="0">
<div id="yw6-content" style="">
<th id="piezaspresupuesto-grid_c0">pieza</th><th id="piezaspresupuesto-grid_c1"><a class="sort-link" href="/yiitest/index.php?r=presupuestos/actualizar&id=8&pedido=2&qdsClass=EAjaxJuiDlg&qdsDialogId=yw6-dlg&qdsContentWrapperId=yw6-content&qdsGridId=presupuestospedido-grid&qdsCloseDialog=1&_=1346959395440&PresupuestosPiezas_sort=Cantidad">Cantidad</a></th><th id="piezaspresupuesto-grid_c2"><a class="sort-link" href="/yiitest/index.php?r=presupuestos/actualizar&id=8&pedido=2&qdsClass=EAjaxJuiDlg&qdsDialogId=yw6-dlg&qdsContentWrapperId=yw6-content&qdsGridId=presupuestospedido-grid&qdsCloseDialog=1&_=1346959395440&PresupuestosPiezas_sort=Precio">Precio</a></th><th id="piezaspresupuesto-grid_c3"> </th></tr>
</thead>
<tbody>
<tr class="odd"><td>muñequera de Radio Frecuencia</td><td>20</td><td>33.24</td><td><div id="yw0-dlg">
<div id="yw0-content" style="display:none"></div></div><img onclick="yw0Ajax();$('#yw0-content').show();$('#yw0-dlg').dialog('open');return false;" style="cursor:pointer;" src="/yiitest/images/Iconos/Led/application_edit.png" alt="EditarPiezaPresupuesto"></td></tr>
....
</tbody>
</table>
<div class="keys" style="display:none" title="/yiitest/index.php?r=presupuestos/actualizar&id=8&pedido=2&qdsClass=EAjaxJuiDlg&qdsDialogId=yw6-dlg&qdsContentWrapperId=yw6-content&qdsGridId=presupuestospedido-grid&qdsCloseDialog=1&_=1346959395440"><span>6</span><span>7</span><span>8</span><span>9</span></div>
</div> <div class="row buttons">
<input type="submit" name="yt0" value="Save"> </div>
</form>
</div><!-- form -->
....
The Id’s from the new dialog are the same of the parent dialog (yw0,yw1,yw2…). New element may start in the last of the parent (yw7).
Does anyone know how to do?
Thanks
a bug:
EQuickDlgs::iframeButton(
array(
'controllerRoute' => 'create',
'dialogTitle' => 'Add',
'openButtonText' => 'Add',
'closeButtonText' => 'Close',
'closeOnAction' => true, //important to invoke the close action in the actionCreate
'refreshGridId' => 'asdf-grid', //the grid with this id will be refreshed after closing
'jsBeforeOpenDialog'=>'console.log(\'before\');',
'jsAfterOpenDialog'=>'console.log(\'after\');',
)
);
generates code:
<input onclick="console.log('before');$('#yw0-frame').attr('src','/create?qdsClass=EFrameJuiDlg&qdsDialogId=yw0-dlg&qdsContentWrapperId=yw0-content&qdsIFrameId=yw0-frame&qdsGridId=asdf-grid&qdsCloseDialog=1');$('#yw0-content').show();$('#yw0-dlg').dialog('open');return false;console.log('after');" name="yt0" type="button" value="Add">
console.log('after');
will bever run because of
return false;
also is there a possibility to pass parameters for the src?