我已经为模型Faq生成了 giix crud
控制器:
public function actionAdmin() {
$model = new Faq('search');
$model->unsetAttributes();
if (isset($_GET['Faq']))
$model->setAttributes($_GET['Faq']);
$this->render('admin', array(
'model' => $model,
));
}
查看 - 管理员:
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id' => 'faq-grid',
'dataProvider' => $model->search(array('order'=>'order ASC')),
'filter' => $model,
'columns' => array(
'order',
'question',
'answer',
array(
'class' => 'CButtonColumn',
),
),
)); ?>
我想按字段“订单”订购商品,所以我添加
array('order'=>'order ASC')
了,$model->search();
但这并没有改变任何东西。错在哪里?