What is the difference and relationship between PositionColumn and DraggableColumn ?
It seems we have 2 columns that serve somehow the same purpose.
-
PrestaShop\PrestaShop\Core\Grid\Column\Type\Common\PositionColumn -
PrestaShop\PrestaShop\Core\Grid\Column\Type\Common\DraggableColumn
On CMS pages listing, PositionColumn is used alone and provides the desired behavior (= have a drag-and-droppable "position" column). On Category listing, DraggableColumn is used with CategoryPositionColumn to provide the desired behavior.
Looks like duplicated logic needing refactoring.
Thanks for opening this issue! We will help you to keep its state consistent
This is related to this issue as well https://github.com/PrestaShop/PrestaShop/issues/12368 Category grid has a different way of handling its position, mainly because the algorithm is different and uses nested tree This would need to be homogenized, so that PositionColumn is used everywhere, and it doesn't need this extra column because the GridPresenter automatically adds it when necessary (the idea was to make the use of PositionColumn easier)
Ping @PrestaShop/prestashop-core-developers what's the status of this issue?
IMHO, Draggable should provide the Draggable feature only without checking if it's a name, position, category, number, etc.
The Position should be also a Draggable but consider only the position field.
I noticed this while working on sorting feature on CMS pages, I'm going to rework my PR to CQRS so I'll back to y'all with some feedback about using those two classes soon 😅
Thanks @kpodemski Waiting fo your feedback :wink: