C
C
CTS42016-12-24 15:59:00
Yii
CTS4, 2016-12-24 15:59:00

Yii 2 How to display records through ListView from a specific position (for example 23)?

I get articles by rating from the base, but I need to output not from the first (with the highest rating), but for example from the one that is 23rd.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
melnikov_m, 2016-12-24
@CTS4

When querying the database, set offset

D
Dmitry, 2016-12-24
@slo_nik

Good afternoon.
In the request, indicate that you need to display those records in which some field, I don’t know what it is called for you, is greater than or equal to 23.
Something like this

$dataProvider = new ActiveDataProvider([
            'query' => Model::find()->where(['>=','position', 23]),
        ]);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question