search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Find multiple events using DayPilot.Scheduler.events.find

Asked by Giliam
3 years ago.

Is it possible to find multiple events using DayPilot.Scheduler.events.find( <function> )?

I know it is possible to pass a custom function, i.o. an eventId, to the method. But that returns only the first event that matches the criteria. I'm looking for a way to return the resultset as an array , a.k.a. an array of events that matches the criteria.

Hint: an extra <findAll> parameter (default false) and returning an array as result might do the job. Otherwise a new function DayPilot.Scheduler.events.findAll().

Answer posted by Dan Letecky [DayPilot]
3 years ago.

The primary purpose of events.find() is to find an event by ID. It searches events.list and if you need to filter the event data I recommend accessing the data store directly:

let events = dp.events.list.filter(data => data.text.startsWith("a")).map(data => new DayPilot.Event(data, dp));

or

let events = dp.events.list.map(data => new DayPilot.Event(data, dp)).filter(e => e.data.text.startsWith("a"));

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.