A
A
AlexSer2021-12-10 10:55:40
Yii
AlexSer, 2021-12-10 10:55:40

How to display only the latest posts in gridView in Yii2?

How can I make the GridView only show 1 record (if there is a repeat) and only the last record
61b307fa6083a576631999.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey, 2021-12-11
@reaferon

gridView is not involved in setting the task here, it's just a display tool.
You need to compose the query required by the condition, wrap it in a DataProvider (Active, Array etc) and then pass it to the gridView widget.
That is, drawing up an ActiveRecord query is primary here. Without understanding the structure of your data, no one will help here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question