F
F
FasterTans2020-11-04 09:04:27
Yii
FasterTans, 2020-11-04 09:04:27

How to add a second field to the searchmodel for sorting without displaying on the UI?

Case:
I import goods, when importing, everything starts with one date with a timestamp (I write it to creatred_at)
The searcmodel is 'defaultOrder' => ['created_at' => SORT_DESC] .
As a result, the field is sorted, everything works out, but after the changes, the date of the change is put in updated_at, and our line randomly jumps into the middle.
If I initially do 'defaultOrder' => ['created_at' => SORT_DESC, 'updated_at' => SORT_DESC], then it stops jumping, the necessary lines are where they should be, but in the view, sorting by 2 columns is displayed in gridview, and if I change sorting by another field, it is impossible to sort by 2 columns again. Can I somehow implicitly add sorting by the second column?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question