How to save a particular, mutable “order” into a database

后端 未结 9 939
北恋
北恋 2021-02-05 03:34

Suppose I have some objects, and I want the user to be able to reorder them in any way they wish, say, by dragging them around. So I\'d have

  • Cheese
  • Muffin
9条回答
  •  名媛妹妹
    2021-02-05 04:20

    If you want to have them redisplayed in the same order AND you want them to be able to reordered at any time I don't think you can get away from storing some value that indicates display priority in the database. I've used the very approach you describe to order items in an FAQ, researchers associated with a grant, the order of items in a menu, ...

提交回复
热议问题