S
S
Stepan2015-02-18 11:35:51
Yii
Stepan, 2015-02-18 11:35:51

(Yii2) How to sort what ListView renders by 'id'?

I render posts. But for some reason, starting from the first id, you need to somehow change the order. Can't deal with it

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stepan, 2015-02-18
@xoma2

$dataProvider = new ActiveDataProvider([
            'query' => $query,
            'sort' => ['defaultOrder' => ['id' => SORT_DESC]],
        ]);

That's how the issue was resolved!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question