-
Notifications
You must be signed in to change notification settings - Fork 235
Description
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.