(ASK) delete button in gridview from other model

anybody have a solution to delete record in gridview?

the problem is the gridview was generate by the other model.

for example i had 2 table, table content and image…

content have more than 1 image so i want to display gridview image in view content…

so if i click the view, i can see the contents of content and record image from that content in gridview…

in that gridview, i add delete button from cbuttoncolumn…

but the button didn’t works…

need help please…

i’m newbie in yii…

You can try http://www.yiiframework.com/extension/eupdatedialog/

thanks for the reply…

but why my delete confirmation has blank???

no button or confirmation??

i put my delete view one folder with my else view…

something wrong in my url???

‘deleteButtonUrl’ => 'Yii::app()->createUrl( “/content/delete-view”,

array( “id” => $data->primaryKey ) )’,

            'buttons' => array(

	'delete' => array(

	'click' => 'updateDialogDelete',


Not sure. Is your view which has a form is named ‘_delete.php’ or have you changed the ‘ajaxView’ in actions to the one you use?

i had form delete.php. it’s from the extension n i have been modifying.

this is the code

this code in my view

in my controller

[color="#A0522D"]any wrong with that??[/color]

[color="#A0522D"]where i must put this code??[/color]

The way I see it, the problem is that you’re using old code (views, controllers, etc) from the version 1.0 but the extension you’re using is version 2.0 and most of the old stuff is gone in new version.

This code:

$widgetUpdate = "js:function(){}";

$this->widget( 'ext.EUpdateDialog.EUpdateDialog', array(

  'options' => array(

    'successCallback' => $widgetUpdate,

    'deletedCallback' => $widgetUpdate,


  'preload' => array( Yii::app()->request->baseUrl . '/js/wymeditor.js' ),


is for the new extension version, and reread the documentation how to use new version.

i have reread from the documentation but i still don’t have any idea where i must put the code??

sorry i’m newbie here so i don’t know a lot…

thx for your reply…

solve with chtml link…


Well actually this code only adds the widget and it’s configuration, so actually it doesn’t matter where in the view you will add this :)

but i always get error ‘undefined option’ when i put that code in view…

what is just because??

Is it JavaScript or PHP error? In my app adding this unconfigured peace of code works like it should without any errors.


Strange, I don’t get any errors on my local or remote servers…

Does your app works without using extension or with JS turned off (in other words full requests)?

If not, how about you try pinpointing the problematic code (remove or add code incrementally to check for a pointer where it starts working/notworking) so I have a better idea what might be wrong with it.

I’m experiencing exactly the same issue with a cgridview of a model inside another model form.

I have EUpdateDialog working fine, but I think that it does not solves the issue because it’s related to the CGridView componente behavior. Looks like a bug.

I have a form for model A (Empresa) containing a grid with data from model B (Unidad).

It’s shown in the Create action of model Empresa.

I have a very simple grid in _form.php:

<?php $this->widget(‘zii.widgets.grid.CGridView’, array(

'id' =&gt; 'unidad-grid',

'itemsCssClass' =&gt; 'sortable',

'dataProvider' =&gt; &#036;model-&gt;searchUnidads(),

'columns' =&gt; array(



	array(	'class' =&gt; 'CButtonColumn',),


)); ?>

And a refresh link for testing pourposes:

<a href="javascript:$.fn.yiiGridView.update("unidad-grid");">Refresh the Grid</a>

When I click the link the grid should be updated calling /unidad/admin&ajax=unidad-grid

but the actual HTTP request is /empresa/create&ajax=unidad-grid

(as shown in firebig)

Looks like a bug… or I’m doing something wrong? I think that it’s the same issue experienced by Angela88.

i had the same problem of Angela 88; i had to rewrite delete cbuttoncolumn because it did refer to wrong model :(:frowning::(