Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable sort for a column in CGridView?

There is the enableSorting flag, that, if equals false, disable sorting for all grid columns. But how can I do this for just one specific column?

like image 294
Tasso Evangelista Avatar asked Dec 19 '22 14:12

Tasso Evangelista


1 Answers

try this

'sortable'=>false, 

Here is example ,

$this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'tasks-grid',
    'dataProvider'=>$model->search(),
    //'filter'=>$model,
    'columns'=>array(
        'id',
        array(
        'header'=>'Surname',
        'value'=> '$data->surname',
            'name'=> 'surname',
            'sortable'=>false,
            ),
        'due_date',
        'status',       
    ),
like image 131
ramamoorthy_villi Avatar answered Feb 23 '23 21:02

ramamoorthy_villi