Need To Remove Js Delete Confirmation

Hi All,

I need to remove js confirmation popup when I click on delete button in CGridView.

The confirmation is been handled in action and view in php.

The delete button does ajax call and invokes the action to get the response.

Everything works on the first page, when we go to the second page (CLinkPager) it gives the popup when clicked on the delete.

Please help me get this working!

Thanks in advance!

Does deleteConfirmation help you?

There is a Property in CButtonColumn as "deleteConfirmation",Make that Property to False then u will never get any Confirmation Message

you can call the afterAjax method on second pagination


		//code here


Hi All,

As suggested by Maurizio and Dinesh, I have added deleteConfirmation => false in my CGridView widget and its not showing the js message.

Now after doing above changes it does not show the js confirmation message but it does not calls the action. When I click on the button it calls this js function -

jQuery('#user-groups-grid a.delete').live('click',function() {


	var th=this;

	var afterDelete=function(){};

	$.fn.yiiGridView.update('user-groups-grid', {



		success:function(data) {




		error:function(XHR) {

			return afterDelete(th,false,XHR);



	return false;


And does nothing after this. So action is not getting called on 2nd page of the navigation.

I believe problem is related to ajax links. Now I will explain page layout and how it flows so that you can understand the problem.

I have menu ajax link which updates the content div and in content I have this delete ajax link which comes as ajax response rendered by action.

On first page everything works fine, but when we go to second page it gives js confirmation alerts.

Please help!

you can put js code in function then after this function call on afterAjax method on grid view…



function test(){

  // your js live click function







i hope it’s work

Hello Maggie Q,

Thank you for the reply!

I am not able to understand where I should do the changes you suggested.

My menu link is ajax link -

echo CHtml::ajaxLink('Groups',


                    array('success' => "function(data) {\$('#content').html(data);}"),

                    array('class' => 'left_border', 'href' => Yii::app()->createUrl('manage/groups/admin'), 'live'=>false)


The above page has zii.widgets.grid.CGridView and I have customized the CButtonColumn as follows -

class AjaxButtonColumn extends CButtonColumn {

    protected function initDefaultButtons() {

        $this->buttons = array(

             'delete' => array(

                'url' => 'Yii::app()->controller->createUrl("delete",array("id"=>$data->id))',

                'label' => 'delete',

                'options' => array(

                    'ajax' => array(

                        'type' => 'POST',

                        'url' => 'js:$(this).attr("href")',

                        'success' => 'js:function(data){$("#content").html(data);}',


                    'live' => false,








And above setup popup’s up js confirmation box on second page of pagination which I do not want at all.

Sometimes it gives multiple js popup, this could be because of multiple ajax handler registration!

Please guide to solve this problem!