Comment posted by FM
7 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
7 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
7 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
7 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]
7 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
7 years ago.

Great stuff. It will make the code cleaner.

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