The events.find() method returns the first Scheduler event that matches the specified event id or custom search function.
Using an event id:
DayPilot.Scheduler.events.find(id)Using a custom search function:
DayPilot.Scheduler.events.find(f)id (string | number) - event id to look up
f (function) - predicate function that returns true when the search condition is met
Find function syntax:
function f(e) {}Find function parameters:
e (DayPilot.Event) - object to test
Returns a matching DayPilot.Event object or null. If multiple events use the same id, the first one is returned.
When you pass a custom search function, events.find() stops at the first event for which the predicate returns true.
Use events.findAll() if you need every matching event instead of just the first one.
Case-insensitive search using event text:
const query = "my text";
const event = dp.events.find((e) => e.text().toUpperCase().includes(query.toUpperCase()));DayPilot.Scheduler.events.findAll()
Client-Side Event API [doc.daypilot.org]