yii cactivedataprovider 默认排序是指定的,但是前台使用AJAX排序是无效的。使用 sortableattributes 排序无效
public function actionIndex()
{
// renders the view file 'protected/views/site/index.php'
// using the default layout 'protected/views/layouts/main.php'
$article = new CActiveDataProvider('article',array(
'criteria'=>array(
'order'=>'id DESC',
),
'pagination'=>array(
'pageSize'=>15,
),
));
$this->render('index',array('article'=>$article));
}
$this->widget('bootstrap.widgets.TbListView', array(
'dataProvider'=>$article,
'itemView'=>'_list', // refers to the partial view named '_post'
'template'=>'{sorter}{items}{pager}{summary}',
'sortableAttributes' => array(
'id',
'date'
)