0

我想添加确认删除,怎么做?

'delete'=>array(
            'class'=>'\ext\crud\actions\DeleteAction',
            'modelName'=>'ManagerCategory',
            array('confirm' => 'Are you sure?'),
            'definedAttributes'=>array(
                'id'=>r()->getQuery('id'),
                'store'=>$this->module->getStoreId(),
            )
        )

谢谢!

4

2 回答 2

2

这真的取决于你如何做到这一点。这是我经常使用的使用 CHtml 按钮的确认方法示例。

<?php echo CHtml::submitButton('Cancel', array('name'=>'cancel', 'class'=>'button alert large submit','confirm'=>'Are you sure you want to cancel the whole order?')); ?>
于 2013-11-07T11:51:56.070 回答
0

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?")',
                    ),
                ),
            )
        ),
于 2013-11-07T12:05:11.480 回答