ProSchedulerSign in

Timeline · Resources

Drag to reorder resources

resourceReorder adds a grip to each row: drag it to move the resource among its siblings. onResourceOrderChange hands back the whole tree in its new order.

Live demo

Move Gus to the top of Post-production · Reorder the departments

Fullscreen
import { useState } from "react"
import { ProScheduler } from "@andreisaac/pro-scheduler"
import { studioSessions, studioTeams } from "./data/studio"
import { useEvents } from "./kit"

export function ResourceReorderDemo() {
  const { events, handlers } = useEvents(() => studioSessions())
  const [resources, setResources] = useState(studioTeams)
  return (
    <ProScheduler
      data={events}
      resources={resources}
      resourceReorder
      onResourceOrderChange={({ resources: next }) => setResources(next)}
      view={{ timeline: { type: "week", resolutionHorizontal: "hour", startTime: "08:00", endTime: "19:00" } }}
      styleConfig={{ unitWidthPx: 24, fitToWidth: false, resourceColWidth: 200 }}
      height={560}
      {...handlers}
    />
  )
}

About this demo

resourceReorder adds a grip to each row: drag it to move the resource among its siblings. onResourceOrderChange hands back the whole tree in its new order.

Things to try

  • Move Gus to the top of Post-production
  • Reorder the departments

The props behind it are explained in Selection, drag and drop, links.

Use ProScheduler in your project