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
),