I encounter this issue when I create REST API.
I cannot tell the exact scenario, but let's say it is for a website that has category and product resources.
Each category has many products and both category and product are ordered.
I originally add an order incremental integer attribute to the resources so both collections can be displayed in correct order.
The problem with my original approach is when user drags and drops a product, a lot of other product's order attributes need to be changed. (When you move the 10th product into 1st place 10 order attributes need to be updated) This is awful for REST API and the database itself.
Is there any way to create an attribute to order product (or model the collection with other approach) so that drag and drop ordering can be done with a single (or few in scalable way) resource items changed?
The answer to the question above without any more condition is good but it would be great if it also works when user drag product from one category and drop it in other category.