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

Calendar - List of all Events

Asked by JDEC
4 years ago.

Hello,

I saw this thread:
https://forums.daypilot.org/question/2907/all-day-events-on-month-view

How would it work for the Calendar view ?

I would like to list into an array all the events between 2 dates.

Thanks

Comment posted by FM
4 years ago.

Commenting on my question:

I used

var eStart = nav.visibleStart().toString(); // June 1st
var eEnd = nav.visibleEnd().toString(); // June 24th
dp.events.list = [ {start: eStart, end: eEnd}]; // var dp = new DayPilot.Calendar("dp");

but this returned an empty array while I have events during the month.

Any idea why ?

Comment posted by FM
4 years ago.

2nd comment:

events.list is not the right function.

So I am trying to use:
function loadEvents() {dp.events.load("backend_events.php"), function success(args)
{
args.preventDefault();
listEvents = args.data;
}
}
but still unlucky.

Comment posted by FM
4 years ago.

2nd comment:

events.list is not the right function.

So I am trying to use:
function loadEvents() {dp.events.load("backend_events.php"), function success(args)
{
args.preventDefault();
listEvents = args.data;
}
}
but still unlucky.

Comment posted by FM
4 years ago.

There was a typo and loop missing

correct syntax is

function loadEvents() {dp.events.load("backend_events.php", function success(args)
{
for (var i=0;i<args.data.length;i++)
{
listEvents[i] = args.data[i];
}
}
)
}

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

The latest sandbox build (2019.2.3891) now supports DayPilot.Calendar.events.forRange(start, end) method. It will return events from the specified range.

var selectedEvents = dp.events.forRange("2019-06-01", "2019-06-07");

Please let me know if this is not what you are looking for.

Comment posted by FM
4 years ago.

Great stuff. It will make the code cleaner.

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