The onResourceCollapse event handler fires in the JavaScript Scheduler when the user collapses a resource tree node.
DayPilot.Scheduler.onResourceCollapse(args)args.resource (DayPilot.Row) - collapsed resource row
args.preventDefault() - prevents the action specified by resourceCollapseHandling, but does not stop the node from collapsing
Calling args.preventDefault() doesn't prevent the node from collapsing. It only prevents the action specified by resourceCollapseHandling, such as "PostBack" or "CallBack".
In api=1 mode, the legacy signature is onResourceCollapse(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
JavaScript
const dp = new DayPilot.Scheduler("dp", {
onResourceCollapse: (args) => {
console.log("Collapsed resource", args.resource);
},
// ...
});
dp.init();Angular
<daypilot-scheduler [config]="config"></daypilot-scheduler>config: DayPilot.SchedulerConfig = {
onResourceCollapse: (args) => {
console.log("Collapsed resource", args.resource);
},
// ...
};React
<DayPilotScheduler
onResourceCollapse={onResourceCollapse}
{/* ... */}
/>const onResourceCollapse = (args) => {
console.log("Collapsed resource", args.resource);
};Vue
<DayPilotScheduler
@resourceCollapse="onResourceCollapse"
<!-- ... -->
/>const onResourceCollapse = (args) => {
console.log("Collapsed resource", args.resource);
};Resource Collapse Event [doc.daypilot.org]