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

enter image description here

有帮助吗?

解决方案

'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}',
),
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top