DayPilot.Month.events.find

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 found

  • f (function) - find function that returns true if the search condition is met

Find function syntax:

function f(e) {}

Find function parameters:

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

DayPilot.Event Class

Client-Side Event API [doc.daypilot.org]

DayPilot.Month Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript