Problems with sorting in CListView

Hi,

I’m pretty new with Yii and i’ve problems with sortableAttributes (maybe i dont know how to set them correctly)

My problem is that when i try to sort it doesn’t update the view. I dont know if I should somehow use DBCriteria or am i doing something else wrong. I would really appreciate if somebody could help me to set sorting work.

Controller:

                    $dataProvider=new CActiveDataProvider('Customer', array(


		'pagination'=>array(


			'pageSize'=>20,


		),


	        ));





                   $this->render('index',array(


		'dataProvider'=>$dataProvider,


	        ));  

View:

<?php $this->widget(‘zii.widgets.CListView’, array(

'dataProvider'=&gt;&#036;dataProvider,


'itemView'=&gt;'_view',





    'enableSorting'=&gt;'true',


    'sortableAttributes'=&gt;array(


            'firstname',


            'lastname',


            'created',


    ),

)); ?>

For me everything seems fine. Check out what the ajax requests are. Alternatively you can disable javascript in your browser to perform regular request while sorting.

I’ve got a problem with sorting when have defined dbCriteria with specified ‘order’ clause.

Hope this helps somehow :>.

use GET instead of POST

Men, do you have some examples about it or its possible to give me help?

I’ve the same problem, bcs when I made the View and set the widget, I do not where else to do.

Plse, help me.

This is my script:

Controller (ContentController attached):


$models = new CActiveDataProvider('ContentArticles', array(

                    'pagination' => array(

                        'pageSize' => 5

                    ),

                    'criteria'=>array(

                        'order'=>'modified DESC'

                    )

                ));


        $this->render('index',array('models'=>$models));

View (index attached):


$this->widget('zii.widgets.CListView', array(

        'dataProvider' => $models,

        'itemView' => '_article', // refers to the partial view named '_article'

        'sortableAttributes' => array(

            'modified',

            'title',

            'sections_id',

        ),

        'sorterHeader' => 'Ordenar por: ',

          'enableSorting' => true,


         

        'template' => "{sorter}\n<br/>{items}\n<br/><center>{pager}</center>",

        'pager' => array(

            'header' => '',

            'firstPageLabel' => '&lt;&lt;',

            'lastPageLabel' => '&gt;&gt;',

            'prevPageLabel' => '&lt; Anterior',

            'nextPageLabel' => 'Siguiente &gt;',

        ),

    ));

Partial View (_article):




echo CHtml::link(CHtml::encode($data->title),array('/content/article', 'id' => $data->id))."<br/>";

echo $data->introtext;

echo $data->fulltext;