例えば商品のランキングを手動で管理する場合、 商品データに並び順のようなものをつけてその順序で表示すると思うのだけど、 並び順を設定するUIをどのように作るのが良いか。 近いうちに作る機会がありそうなので、考えてみる。 ReactやVue.jsを使う機会はなさそうなので、jQueryベースで。 やりたいこと 既に商品マスタはあり、ソート順を設定できるカラムもあるとする。 できるだけ楽にランキングを変更できて、 データの更新数が最小限になる方法を見つけたい。 色々やり方はありそうだけど、 まずは一番簡単に実装できそうな方法で作ってみよう。 簡単に実装できそうな方法 商品がリスト状に並んでいるとして、 並び順を楽に変更する方法としては、 ドラッグしてリストの順序を変更するUIがオーソドックスで良さそう。 これはjQueryUIのsortableウィジェットで実現できる。 jqueryui.co