3rd party calendar Daypilot

Has anyone sucessfully integrated the 3rd party Daypilot Calendar Javascript control?
This has all sorts of useful views including scheduling and resources, some of which are available free and open source.
https://code.daypilot.org/17910/html5-event-calendar-open-source

I have got a basic Calendar to render and have populated it with 2 in-line events using:

The next step is to populate it from a database table. So I created a Postgres table called schedule with a few events:

and hooked up to it with an API called get_schedule:

Then I can get the data into the browser with a http call and attempt to populate the calendar:

This is the result:


I get the error ‘Daypilot.Calendar.events.list expects an array object. You supplied: object’
So after several days of trial and error, I feel I’m nearly there.
I’ve tried several ways of converting the object to an array without success.
Is the data in the console formatted correctly? - do I need quotes around the keys?
Can anyone point me in the right direction to get me over the line?

Sorry - only a fleeting look
It looks like you should be using data.query for the console log and in the dp.update()

1 Like

Thanks for the suggestion.

The console.log(data.query) seems to cause an error in the browser - it’s saying ‘undefined’:
UsingData.query
Output:


If I comment out the line: console.log(data.query), I get no error message but also no events on the calendar. So it looks like it might have fixed the array issue.
Do you think I need the quotes on the keys in the data?

Can you try data.data.query?

Thanks Ben, that works a treat!
The data is visible in the console.log and the events are rendered on the calendar.
It looks like below - the upper part being a bootstrap table of the same events.
Many thanks for your guidance: