Yii 使按钮在CJUI对话框中不可见

Yii 使按钮在CJUI对话框中不可见,yii,Yii,我在yii中的CJuiDialog有问题。我想将“删除”按钮设置为“不可见”,但这不起作用,按钮仍会显示。 这是我的密码: $this->beginWidget('zii.widgets.jui.CJuiDialog', array( 'id' => 'dlg_EventCal', 'options' => array( 'title' => Yii::t('CalModule.fullCal', 'Event detail'), 'modal' =>

我在yii中的CJuiDialog有问题。我想将“删除”按钮设置为“不可见”,但这不起作用,按钮仍会显示。 这是我的密码:

$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
'id' => 'dlg_EventCal',
'options' => array(
    'title' => Yii::t('CalModule.fullCal', 'Event detail'),
    'modal' => true,
    'autoOpen' => false,
    'hide' => 'slide',
    'show' => 'slide',
    'width'=> 400,
    'buttons' => array(
        array(
            'text' => Yii::t('CalModule.fullCal', 'OK'),
            'click' => "js:function() { eventDialogOK(); }"
        ),
        array(
            'text' => Yii::t('CalModule.fullCal', 'Cancel'),
            'click' => 'js:function() { $(this).dialog("close"); }',

        ),  
         array( 
    'text' => Yii::t('CalModule.fullCal', 'Delete'),
    'click' => 'js:function() { eventDialogDelete(); }',
   'visible'=>Yii::app()->user->checkAccess('deleteAllEvents'),

            ),

))));

cguidialog
仅将数据传递给
jQuery.dialog
插件

查看此函数(从中):

但在这种情况下,您需要额外检查服务器端的权限

_createButtons: function( buttons ) {
    var that = this,
        hasButtons = false;

    // if we already have a button pane, remove it
    this.uiDialogButtonPane.remove();
    this.uiButtonSet.empty();

    if ( typeof buttons === "object" && buttons !== null ) {
        $.each( buttons, function() {
            return !(hasButtons = true);
        });
    }
    if ( hasButtons ) {
        $.each( buttons, function( name, props ) {
            var button, click;
            props = $.isFunction( props ) ?
                { click: props, text: name } :
                props;
            // Default to a non-submitting button
            props = $.extend( { type: "button" }, props );
            // Change the context for the click callback to be the main element
            click = props.click;
            props.click = function() {
                click.apply( that.element[0], arguments );
            };
            button = $( "<button></button>", props )
                .appendTo( that.uiButtonSet );
            if ( $.fn.button ) {
                button.button();
            }
        });
        this.uiDialog.addClass( "ui-dialog-buttons" );
        this.uiDialogButtonPane.appendTo( this.uiDialog );
    } else {
        this.uiDialog.removeClass( "ui-dialog-buttons" );
    }
}
array( 
    'text' => Yii::t('CalModule.fullCal', 'Delete'),
    'click' => 'js:function() { eventDialogDelete(); }',
    'style' => Yii::app()->user->checkAccess('deleteAllEvents') ? '' : 'display: none;',
)