sortable grid view with CSqlDataProvider

hi, i’m using CSqlDataProvider to display some data in a grid view. right now i’m using the bootstrap grid view.

the problem is that i cannot make the grid sortable.

if just pust ‘sort’ in the declaration like this:


            $dataProvider = new CSqlDataProvider($sql, array(

                    'sort'=>array(

                        'attributes'=>array(

                            'cnt', 'name'

                        ),

                    ),

                    'keyField' => $key,

                    'pagination'=>array(

                        'pageSize' => 1000000,

                    ),

            ));

it produces the links on column names, as if they were sortable, but after clicking on them the grid content simply disappears.

so, is there a way to make the grid view sortable with the sql data provider?

Sort attributes can be more complex. See: http://www.yiiframework.com/doc/api/1.1/CSort

Briefly you can use




'sort'=>array(

         'attributes'=>array(

              'cnt' => array(

                   'asc' => 'some sql expression',

                   'desc' => 'some or the above sql expression DESC' 

              ),

              ...

          ),

),

...