docs icon indicating copy to clipboard operation
docs copied to clipboard

What is the difference and relationship between PositionColumn and DraggableColumn ?

Open matks opened this issue 5 years ago • 6 comments

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.

matks avatar May 06 '20 13:05 matks

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)

jolelievre avatar May 06 '20 14:05 jolelievre

Ping @PrestaShop/prestashop-core-developers what's the status of this issue?

hibatallahAouadni avatar Jan 17 '21 18:01 hibatallahAouadni

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.

PierreRambaud avatar Jan 19 '21 08:01 PierreRambaud

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 😅

kpodemski avatar Jan 19 '21 09:01 kpodemski

Thanks @kpodemski Waiting fo your feedback :wink:

hibatallahAouadni avatar Jan 19 '21 09:01 hibatallahAouadni