DayPilot.Scheduler.events.find

The events.find() method returns the first Scheduler event that matches the specified event id or custom search function.

Declaration

Using an event id:

DayPilot.Scheduler.events.find(id)

Using a custom search function:

DayPilot.Scheduler.events.find(f)

Parameters

  • 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:

Return Value

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

Notes

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.

Example

Case-insensitive search using event text:

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

See Also

DayPilot.Scheduler.events.findAll()

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

DayPilot.Scheduler Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript