1
yii cactivedataprovider默認排序是指定的,但前臺使用AJAX排序無效。使用sortableattributes 排序是無效yii cactivedataprovider默認排序是指定的,但前臺使用AJAX排序無效
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'
)
謝謝你,我按照你的問題的解決方案 – user1295679