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

Backend events are not loaded in the resource calender

Related article: JavaScript Resource Calendar Tutorial - PHP/MySQL (Open-Source)
Asked by Anonymous
10 months ago.

DayPilot Lite: 2022.2.382-lite

PHP 8.3.2

Once after created a new event and the event got stored in the database.

On refresh, the backend_events.php provides the list of events as json from the database but daypilot-all.min.js failed to render into the calender.

Remarks: Added #[AllowDynamicProperties] to allow the dynamic properties

Comment posted by Dan Letecky [DayPilot]
10 months ago.

I recommend checking if there is any error in the JavaScript console (browser developer tools). This may provide additional hints.

Also, if you have modified backend_events.php I recommend checking the HTTP response (Network tab in the developer tools) to see if the JSON output is what you expect.

Comment posted by Anonymous
10 months ago.

Below is what the list of events in database

backend_events.php gets the expected response and I got this in js as well when I kept breakpoint. No error message in the console but 1 depreciated warning at daypilot-all.min.js:8

If required I can keep breakpoint at desired line and provide the data from the variable to provide more information

Comment posted by Anonymous
10 months ago.

Am adding here the required screenshots from the previous comment.

Answer posted by Dan Letecky [DayPilot]
10 months ago.

Thanks for the update!

The problem is the type of events.resource_id database field. It is incorrectly set to varchar instead of integer. Older versions of PHP/PDO converted integer values to string and in that case it worked.

For the events to be displayed in the correct calendar columns, the resource id must match exactly, including type. In PHP 8, this application produces integer for resources[].id and string for events[].resource.

An updated version of the tutorial is in the works and it will be published later today.

Comment posted by Anonymous
10 months ago.

Thankyou. It works :-)

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