Yii2网格视图窗口小部件按顺序排序

时间:2015-07-14 07:16:16

标签: yii2

我有这样的网格视图

 <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],


            'movie.movie_name',
            'start_date',
            'end_date',
            'theatre.theatre_name',
            'screen.screen_name',
            'time.start_time',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>

我如何根据start_date降序排列?

1 个答案:

答案 0 :(得分:9)

在搜索模型中添加WHERE varchar = varchar AND datetime BETWEEN Date1 AND Date2属性:

sort