Answer the question
In order to leave comments, you need to log in
Yii2 How to do manual sorting - without any hassle?
Good afternoon,
So the situation is this, I upload a lot of pictures, I brought it out. But now I want to manually change the position of the photo queue, I think to change the timestamp of the addition and output accordingly.
But the problem is how to make it pleasant for the user?
Maybe there are some solutions already on this topic?
Or can you share yours? Many thanks in advance.
Answer the question
In order to leave comments, you need to log in
https://github.com/himiklab/yii2-sortable-grid-vie...
In the controller, the ActiveDataProvider will need to disable pagination and sort
$dataProvider = new ActiveDataProvider([
'query' => Images::find()
->orderBy(['sort_order' => SORT_ASC]),
'pagination' => false,
'sort' => false,
]);
use himiklab\sortablegrid\SortableGridView as GridView;
echo GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
/* твои колонки */
],
]);
ничего менять не надо.
дата добавления - это дата добавления, она нужна сама по себе
тем более что таймстамп будет у кучи фоток одинаковый.
Надо добавить отдельное поле для сортировки
Решений миллион.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question