简体   繁体   中英

yii cgridview How to disable button

I know template or visible attribute can make it display or not if I need to display the button but I just want to disable the button. How to make it work

 $this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'customer-grid',
    'dataProvider'=>$model->search(),
    'filter'=>$model,
    'columns'=>array(
       'id',
       'first_name',
     ),
    'template'=>'{update}{delete}'

Try deleteButtonOptions and updateButtonOptions of CColumnButton as

$this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'customer-grid',
    'dataProvider'=>$model->search(),
    'filter'=>$model,
    'columns'=>array(
        'id',
        'first_name',
        array(
            'class' => 'CButtonColumn',
            'header' => 'Manage',
            'template' => '{update}{delete}',
            'deleteButtonOptions' => array(
                'disabled' => true
            ),
            'updateButtonOptions' => array(
                'disabled' => true
            )
        ),
    ),

));

Disable View, Edit and Delete button.

$this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'auction-bid-grid',
    'dataProvider'=>$model->search(),
    'filter'=>$model,
    'columns'=>array(
        'id',
        'name',
        array(
            'class'=>'CButtonColumn',
              'template' => '',
        ),      
    ),  
));

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