DayPilot.Calendar.events.find

The events.find() method finds an event in the Calendar event collection using an event id or a custom search function.

Declaration

Using an event id:

DayPilot.Calendar.events.find(id)

Using a custom search function (available since 2023.3.5603):

DayPilot.Calendar.events.find(f)

Parameters

  • id (string | number) - event id to look up

  • f (function) - predicate function that returns true when the matching event is found

Find function syntax:

function f(e) {}

Find function parameters:

Return Value

Returns a DayPilot.Event object, or null if no event matches. If multiple events use the same id, the first one is returned.

Notes

You can use the returned DayPilot.Event object with the client-side event API to inspect or update the matching event.

Example

Case-sensitive search:

const query = "meeting";
const e = dp.events.find(e => e.text().includes(query));

Case-insensitive search:

const query = "meeting";
const e = dp.events.find(e => e.text().toUpperCase().includes(query.toUpperCase()));

See Also

Client Side Event Api [doc.daypilot.org]

Update Events without Reloading [doc.daypilot.org]

DayPilot.Calendar Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript