The onResourceExpand event handler fires in the JavaScript Scheduler after a resource tree node expands.

Available in DayPilot Lite for JavaScript since version 2026.4.899.

Declaration

DayPilot.Scheduler.onResourceExpand(args)

Parameters

  • args.resource (DayPilot.Row) - expanded resource row

  • args.preventDefault() - prevents the action specified by resourceExpandHandling, but does not stop the node from expanding

Lite Behavior

The callback runs after an individual node changes state, including changes made using the corresponding DayPilot.Row method. The updated row is available as args.resource. Calling args.preventDefault() does not undo the completed expansion; Lite does not perform a server callback or postback.

Bulk tree methods do not guarantee one notification per changed row. Handle the overall bulk action separately when your application needs to react to all changes.

Pro and Legacy Server Integration

Calling args.preventDefault() doesn't prevent the node from expanding. It only prevents the action specified by resourceExpandHandling, such as "PostBack" or "CallBack".

In api=1 mode, the legacy signature is onResourceExpand(resource), where resource is a DayPilot.Resource object with the following properties:

  • start (DayPilot.Date) - resource start (corresponds to startDate when viewType == "Resource")

  • name (string) - resource name

  • value (string) - resource ID

Examples

These snippets attach a notification to an existing resource tree. Keep the existing resources and timeline options.

JavaScript

const dp = new DayPilot.Scheduler("dp", {
  treeEnabled: true,
  onResourceExpand: (args) => {
    console.log("Expanded resource", args.resource);
  },
  // ...
});
dp.init();

Angular

<daypilot-scheduler [config]="config"></daypilot-scheduler>
config: DayPilot.SchedulerConfig = {
  treeEnabled: true,
  onResourceExpand: (args) => {
    console.log("Expanded resource", args.resource);
  },
  // ...
};

React

<DayPilotScheduler
  treeEnabled={true}
  onResourceExpand={onResourceExpand}
/>
const onResourceExpand = (args) => {
  console.log("Expanded resource", args.resource);
};

Vue

<DayPilotScheduler
  :treeEnabled="true"
  :onResourceExpand="onResourceExpand"
/>
const onResourceExpand = (args) => {
  console.log("Expanded resource", args.resource);
};

See Also

Resource Expand Event [doc.daypilot.org]

DayPilot.Scheduler.resourceExpandHandling

DayPilot.Scheduler Class

Availability

Availability of this API item in DayPilot editions:

ProductLitePro
DayPilot for JavaScript