MathiasM
Convex Communityβ€’2y agoβ€’
3 replies
Mathias

How to implement sort by reordering items in a list?

I'm about to implement sorting in a table, where I would like to use either Framer motion or Atlassian Pragmatic drag and drop.

Has anyone experience with mutations and how this can be done? This is the schema for what I want to sort by the
order
column.

js 
  statuses: defineTable({
    name: v.string(),
    description: v.optional(v.string()),
    color: v.string(),
    order: v.number(),
    projectId: v.string(),
    templateId: v.optional(v.string()),
  })
    .index("by_project", ["projectId"])
    .index("by_template", ["templateId"]),


Framer motion reorder seems to do it by index and using states. I would like to avoid states if possible and do mutations directly.

What do you think is a good way to do this?
Create drag-to-reorder effects with a simple set of components.
Reorder | Framer for Developers
Was this page helpful?