The events.find() method finds an event in the Month event collection using an event id or a custom search function.
Declaration
Using an event id:
DayPilot.Month.events.find(id);Using a custom search function (available since 2023.3.5603):
DayPilot.Month.events.find(f);Parameters
id(string | number) - id of the event to be foundf(function) - find function that returnstrueif the search condition is met
Find function syntax:
function f(e) {}Find function parameters:
e(DayPilot.Event) - object to test
Return Value
Returns a matching DayPilot.Event instance or null. If there are more events with the same id, it returns the first one.
Notes
Use the predicate overload when the search depends on event properties instead of the event id.
The returned DayPilot.Event instance can be inspected or updated using the client-side event API.
Example
Case-sensitive search:
const query = "inspection";
const e = dp.events.find(e => e.text().includes(query));Case-insensitive search:
const query = "order";
const e = dp.events.find(e => e.text().toUpperCase().includes(query.toUpperCase()));See Also
Client-Side Event API [doc.daypilot.org]
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot