Sort records in admin view [closed]

0

I need the records that show listings in the CGridView of the admin view to be sorted alphabetically (ascending or descending) in any of the fields. Could you help me?

    
asked by josterricardo 15.12.2015 в 21:55
source

1 answer

2

Update your search() function in the model and add the following code:

'criteria'=>$criteria,
//Agregar aqui

'sort'=>array(
    'defaultOrder'=>'order ASC',
),

And within the admin view change the dataprovider to:

'dataProvider' => $model->search(),

Source in English: link

    
answered by 15.12.2015 / 22:01
source