Reputation: 9309
I want add confirmation delete, how do it?
'delete'=>array(
'class'=>'\ext\crud\actions\DeleteAction',
'modelName'=>'ManagerCategory',
array('confirm' => 'Are you sure?'),
'definedAttributes'=>array(
'id'=>r()->getQuery('id'),
'store'=>$this->module->getStoreId(),
)
)
Thanks!
Upvotes: 0
Views: 1260
Reputation: 9309
So, right answer is
'delete'=>array(
'htmlOptions' => array(
'onclick'=>'return confirm("Are you sure?")',
),
),
Thanks!
P.S.
'list'=>array(
'class'=>'\ext\crud\actions\ListAction',
'modelName'=>'ManagerCategory',
'title'=>'Manage categories',
'definedAttributes'=>array(
'store'=>$this->module->getStoreId(),
),
'columns'=>array(
'id',
'title',
'parent'=>array(
'name'=>'Parent',
'type'=>'raw',
'value'=>'$data->parent?$data->parent0->title:""'
),
'delete'=>array(
'htmlOptions' => array(
'onclick'=>'return confirm("Are you sure?")',
),
),
)
),
Upvotes: 0
Reputation: 4696
It really depends on how you are doing this. Here is an example of a confirmation method using a CHtml Button that I use frequently.
<?php echo CHtml::submitButton('Cancel', array('name'=>'cancel', 'class'=>'button alert large submit','confirm'=>'Are you sure you want to cancel the whole order?')); ?>
Upvotes: 2