S
S
Sergey Pugovkin2017-03-04 14:41:59
Yii
Sergey Pugovkin, 2017-03-04 14:41:59

Sort get params under a different name, how to do?

$provider = new ActiveDataProvider([
            'query' => $articles,
            'sort' => [
                'attributes' => [
                    'rating',
                    'comments',
                    'createdAt',
                ],
                'defaultOrder' => ['createdAt' => SORT_DESC],
            ],
            'pagination' => [
                'defaultPageSize' => 24,
                'pageSizeParam' => false,
                'totalCount' => $articles->count(),
            ],
        ]);

When sorting by createdAt in the URL, how can the createdAt parameter be displayed to others, for example, date?
That is, how to pass createdAt under the name date in the URL?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ruslan, 2017-03-04
@Driver86

$articles - what does the query look like? There, rename this field and then wherever it is, unless of course $articles is not AR?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question