Thanks to visit codestin.com
Credit goes to github.com

Skip to content

List items reordering (draggable) #106

@eduard-sukharev

Description

@eduard-sukharev

Is your feature request related to a problem? Please describe.
Pre-sorting things before showing them to user is a really ubiquitous use case. Menu items, package types, filters priority, managers queue etc. usually should be fetched from DB and shown in UI in some pre-defined order. Usually, this is done with the help of additional column, e.g. sort_order or priority.

Describe the solution you'd like
A table or a list with drag-n-drop capability would be perfect. All items are shown in the order defined by sorting column (e.g. priority). If the order is not defined (no field present or duplicate values) then initial order in the list is undefined, but persisted as soon as it makes sense (e.g. for duplicate values - increment on of the two and recalculate all the following values in the list to become +1 and then call update for each item).
When item is dragged into different position, then sorting value should be updated for all items between it's new position (including item itself) and previous position.
De-bouncing and batching updates might help here.

Describe alternatives you've considered
Having sorting buttons are ok too (see screenshot)
photo_2021-01-07_13-48-12
Upon each button click the two models that have switched places should be updated. De-bouncing calls might be an option here, too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions