简体   繁体   中英

How to Disable Button on CButtonColumn Table

I want to disable the update button from CGridView Table. I don't know how to do it. Just disable the update button, not delete the function of update. Anybody know how to do it? Thanks

在此处输入图片说明

'columns' => array(
        // All your columns here
        // ...
        array(
            'template' => '{view}{delete}',
            'class' => 'CButtonColumn',
        ),
    ),

It's enough :)

EDIT : above solution removes the button. The following disable it (by removing the link):

'columns' => array(
        // All your columns here
        // ...
        array(
            'template' => '{view}{update}{delete}',
            'class' => 'CButtonColumn',
               'buttons' => array(
                   'update' => array(
                      'url' => ''
                    ),
                ),
         ),

You have to change the 'template' property of your CButtonColumn. The default value for 'template' is '{update}{view}{delete}'. So you have to do this:

array(
    'class' => 'CButtonColumn',
    'template' => '{view}{delete}',
),

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM