The events.find() method finds the specified event. To find an event, you can use its id or a custom search function.
Using event ID as a parameter:
DayPilot.Month.events.find(id);
Using custom find function as a parameter (since version 2023.3.5603):
DayPilot.Month.events.find(f);
id
(string | number) - id of the event to be found
f
(function) - find function that returns true
if the search condition is met
Find function syntax:
function f(e) {}
Find function parameters:
e
- DayPilot.Event object
DayPilot.Event object or null. If there are more events with the same id, it returns the first one.
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()));