CubttonColumn custom button with confirmation

I have a custom delete button, all i want is some sort of confirmation before delete action takes place…

I have tried all provided answers with no success so far.

here is my code, I am using CArrayDataProvider thus had to create a template for delete button.and i renderPartial()this grid as widget


 array(

                'class' => 'CButtonColumn',

                'template' => '{delete}{reset}',

                'deleteConfirmation'=>"js:'Are You Sure?'",

                'afterDelete'=>'function(link,success,data){ if(success) alert("Delete completed successfully"); }',

                'buttons' => array(

                    'delete' => array(

                        'label'=> 'Remove this device',

                        'imageUrl'=> Yii::app()->request->baseUrl.'/img/delete.png',

                        'url' => 'Yii::app()->controller->createUrl("controller/action", array("trace_id"=>$data["trace_id"], "mac"=>$data["mac"]))',

                        'click'=><<<EOD


                                function(){

                                confirm('Are you sure?')

                                }

EOD

                    ),

Hi,

for me this code works you should try it


'click' => "function(){

		if(!confirm('Do you confirm?'))

                    return false; 

}"

If user declines nothing happens, if he says yes it will redirect it to url param you defined.

Also try renaming button to something other that delete, for example customDelete and then redirect to your custom delete function.