Question

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

Was it helpful?

Solution

'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' => ''
                    ),
                ),
         ),

OTHER TIPS

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}',
),
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top