The onResourceCollapse event handler fires in the JavaScript Scheduler when the user collapses a resource tree node.
Declaration
DayPilot.Scheduler.onResourceCollapse(args)Parameters
args.resource(DayPilot.Row) - collapsed resource rowargs.preventDefault()- prevents the action specified by resourceCollapseHandling, but does not stop the node from collapsing
Notes
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 tostartDatewhenviewType == "Resource")name(string) - resource namevalue(string) - resource ID
Examples
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);
};See Also
Resource Collapse Event [doc.daypilot.org]
DayPilot.Scheduler.resourceCollapseHandling
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot