T
T
Tokenchik2017-06-01 23:06:23
Yii
Tokenchik, 2017-06-01 23:06:23

How to keep Gridview sort order in YII2?

How to keep gridview sort order when moving from page to page? Particularly relevant is the sorting of applications by status, when viewing one, we return to the applications and again need to be sorted.
A trifle, but not pleasant. What is the most appropriate way to implement this? And if possible - poke your nose into an example.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2017-06-01
@webinar

Particularly relevant is the sorting of applications by status.

This is not in yii out of the box, you implemented it yourself, but how exactly is a big question. We need a psychic here.
depending on what pages it is. If to Google and back, then no way. If it’s about pagination, then how would all the filters be saved anyway, if everything is done correctly (standard crud). But how did you implement it in your project? HZ. Again, a medium is needed.
The question must be formulated in such a way that there is a way to answer it.
Your question is similar to "I am somewhere, I am something, tell me what and where?" Please try to provide the code.

A
Alexander Kuznetsov, 2018-05-31
@diplodok72

And everything is very clear to me, because. exactly the same situation happened.
Out of the box, sorting is done by passing the GET parameter sort. If, after sorting, you switch to a detailed view of the record, and then again to Grid / ListView, then the parameter is lost and, accordingly, sorting is performed by default, and not the one that was.
As a result, I would also like to know how to keep sorting after leaving the list page.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question