Our powerful JS Calendar component


Post by orthobridge »

Hi,

We've upgraded to the latest release and noticed a change in behaviour. (5.4.x -> 6.x)
When the calendar initially loads, it sends a default data range to the server. It then appears to cache this data so any date selections within that default date range no longer force data updates from the server.

Can we either:
Reduce the default data range when calendar loads to 1 day (today)
OR
Force data updates - always ignore what's cached

Thanks


Post by Animal »

I don't understand what you are describing. Can you provide some more detail and context?

So it sends off to the server asking for events for a specific date range.

Then.. you see some kind of problem with some operations?


Post by Animal »

Could you mean this config? https://bryntum.com/products/calendar/docs/api/Calendar/feature/LoadOnDemand#config-alwaysLoadNewRange

The default value of that has not changed.


Post by Animal »

You can check that in https://bryntum.com/products/calendar/examples/load-on-demand/

Go to the YEAR view and see that it shows a toast that announces it's loading a year's worth of events.

Then click on a month header of one of the months there. It won't make a request for the date range there because it already has it because of the previous load.

Go into the code editor and add alwaysLoadNewDateRange : true to the configuration of the feature, and rerun it and do the same thing.

You will see that when you then click on the month header, it will announce that it has loaded a block of events for that month.


Post by orthobridge »

Thanks. Just got there before your reply. Wanted to adjust the initial data range that the calendar selects (2 weeks back/forward from today()) as it's extremely inefficient to retrieve a full month of data in some scenarios.

Got there by adjusting the params.startDate & endDate in beforeSend on initial call


Post by marcio »

Hey orthobridge,

Glad that you found a way for your scenario!

Please don't hesitate if you need further assistance.

Best regards,
Márcio


Post by Animal »

When using a ResourceView, and LoadOnDemand, then in order to know what subviews to create (It has to create one subview of its configured type for each resource in the ResourceStore), it has to first load something into the Project so that there is a ResourceStore to iterate to create views for.

It chooses the month encapsulating the configured date because it is able to use MonthViews. It really might miss out on some data depending on how the backend was coded.

If the backend sends back all resources that you have in the database along with the event load, then there will never be a problem.

If the code is clever and only sends back resources referenced by the events found for the range, then maybe some of your resources won't be returned. If some resource happens to have no events for the week.

If it just sent out a request for the *week", if there just happen to be no events for resource A in that range, then resource A would not get subviews created and you would never be able to add events for that resource.

How does your backend code handle this?


Post by orthobridge »

We manage the resource views on a daily basis. The SQL is fairly complex but ensures we only get what we need. We also have virtual chairs (which are supervisory roles) and a virtual clipboard to cache re-bookings. It all appears to function as it should

Some very basic demo data as follows:

{
    "identity": "df74d09a-9c41-4734-8d0d-2a46d00080d8",
    "success": true,
    "resources": {
        "rows": [
            {
                "id": "a0e40761-23a2-4f6c-a960-32bb33690548",
                "name": "Chair 1 - Jo",
                "title": "Dr Roger J Stephens IIx",
                "userIds": [
                    "df74d09a-9c41-4734-8d0d-2a46d00080d8"
                ],
                "isActive": true,
                "eventColor": "#ac2020",
                "isUnavailable": false,
                "isVirtualChair": false
            },
            {
                "id": "5bf9e786-de26-4ec5-8726-8a78380adb40",
                "name": "Chair 7 - therapist 4",
                "title": "Mr Angus Werth",
                "userIds": [
                    "72f759a5-c52c-4eed-a79c-2965a668b39d"
                ],
                "isActive": true,
                "eventColor": "#a8481f",
                "isUnavailable": false,
                "isVirtualChair": false
            },
            {
                "id": "28ff704e-b14b-4c0c-832b-3ab7110a19a1",
                "name": "SUPERVISOR",
                "title": "Ms. Isabelle Teale",
                "userIds": [
                    "28ff704e-b14b-4c0c-832b-3ab7110a19a1"
                ],
                "isActive": true,
                "eventColor": null,
                "isUnavailable": false,
                "isVirtualChair": true
            },
            {
                "id": "9ccd0e64-91d7-4478-b727-d3e7f5acc078",
                "name": "SUPERVISOR",
                "title": "Mrs. Sharon Beck",
                "userIds": [
                    "9ccd0e64-91d7-4478-b727-d3e7f5acc078"
                ],
                "isActive": true,
                "eventColor": null,
                "isUnavailable": false,
                "isVirtualChair": true
            },
            {
                "id": "2b79964a-8c6a-4938-8428-4a9f0fda15e7",
                "name": "SUPERVISOR",
                "title": "Ms Kathryn Wilson",
                "userIds": [
                    "2b79964a-8c6a-4938-8428-4a9f0fda15e7"
                ],
                "isActive": true,
                "eventColor": null,
                "isUnavailable": false,
                "isVirtualChair": true
            },
            {
                "id": "df74d09a-9c41-4734-8d0d-2a46d00080d8",
                "name": "SUPERVISOR",
                "title": "Dr Roger J Stephens IIx",
                "userIds": [
                    "df74d09a-9c41-4734-8d0d-2a46d00080d8"
                ],
                "isActive": true,
                "eventColor": null,
                "isUnavailable": false,
                "isVirtualChair": true
            },
            {
                "id": "3490b521-230e-4181-8d79-21cc1dc62f34",
                "name": "SUPERVISOR",
                "title": "Mr '\"limited '\"><b>user",
                "userIds": [
                    "3490b521-230e-4181-8d79-21cc1dc62f34"
                ],
                "isActive": true,
                "eventColor": null,
                "isUnavailable": false,
                "isVirtualChair": true
            },
            {
                "id": "ba0972b7-2f7f-49c3-9982-eeae0af3b9d9",
                "name": "SUPERVISOR",
                "title": "Mr robin wood",
                "userIds": [
                    "ba0972b7-2f7f-49c3-9982-eeae0af3b9d9"
                ],
                "isActive": true,
                "eventColor": null,
                "isUnavailable": false,
                "isVirtualChair": true
            }
        ]
    },
    "events": {
        "rows": [
            {
                "id": "0d1d068d-8c9a-42ff-a78a-f0415af5075e",
                "name": " 458131 | Kiefer | CHECK URA 10",
                "notes": "",
                "allDay": false,
                "endDate": "2024-08-13T13:25:00+00:00",
                "iconCls": null,
                "is_video": false,
                "isHoliday": false,
                "startDate": "2024-08-13T13:15:00+00:00",
                "eventColor": "#96bd32",
                "patient_id": "0147c863-0f26-4398-aadf-cb26529a8dc7",
                "resourceId": "a0e40761-23a2-4f6c-a960-32bb33690548",
                "ends_at_tod": "",
                "in_clipboard": false,
                "patient_code": 458131,
                "resourceName": "Dr. Damon Evans",
                "starts_at_tod": "",
                "appointment_id": "0d1d068d-8c9a-42ff-a78a-f0415af5075e",
                "alt_patient_code": null,
                "payment_provider": "Denplan.co.uk",
                "resourceAvatarUrl": "https://smile-docs.s3.eu-west-1.amazonaws.com//practices/profile-images/7a66da71-a200-48ec-be97-e98f24da08eb.jpg",
                "isAppointmentBlocker": false
            }
        ]
    },
    "bookable_days": {
        "rows": [
            {
                "id": "2024-07-01"
            },
            {
                "id": "2024-08-02"
            },
            {
                "id": "2024-07-27"
            },
            {
                "id": "2024-08-22"
            },
            {
                "id": "2024-08-17"
            },
            {
                "id": "2024-08-30"
            },
            {
                "id": "2024-07-20"
            },
            {
                "id": "2024-06-24"
            },
            {
                "id": "2024-07-06"
            },
            {
                "id": "2024-07-18"
            },
            {
                "id": "2024-07-31"
            },
            {
                "id": "2024-06-28"
            },
            {
                "id": "2024-08-14"
            },
            {
                "id": "2024-08-28"
            },
            {
                "id": "2024-08-16"
            },
            {
                "id": "2024-08-23"
            },
            {
                "id": "2024-07-11"
            },
            {
                "id": "2024-09-04"
            },
            {
                "id": "2024-09-16"
            },
            {
                "id": "2024-08-09"
            },
            {
                "id": "2024-09-24"
            },
            {
                "id": "2024-07-19"
            },
            {
                "id": "2024-08-24"
            },
            {
                "id": "2024-07-21"
            },
            {
                "id": "2024-07-17"
            },
            {
                "id": "2024-08-31"
            },
            {
                "id": "2024-08-03"
            },
            {
                "id": "2024-08-29"
            },
            {
                "id": "2024-07-07"
            },
            {
                "id": "2024-07-26"
            },
            {
                "id": "2024-08-05"
            },
            {
                "id": "2024-08-11"
            },
            {
                "id": "2024-08-06"
            },
            {
                "id": "2024-07-25"
            },
            {
                "id": "2024-07-02"
            },
            {
                "id": "2024-06-27"
            },
            {
                "id": "2024-07-10"
            },
            {
                "id": "2024-09-30"
            },
            {
                "id": "2024-08-01"
            },
            {
                "id": "2024-09-12"
            },
            {
                "id": "2024-07-22"
            },
            {
                "id": "2024-09-09"
            },
            {
                "id": "2024-07-13"
            },
            {
                "id": "2024-07-08"
            },
            {
                "id": "2024-10-01"
            },
            {
                "id": "2024-09-19"
            },
            {
                "id": "2024-09-25"
            },
            {
                "id": "2024-07-03"
            },
            {
                "id": "2024-06-25"
            },
            {
                "id": "2024-06-26"
            },
            {
                "id": "2024-06-29"
            },
            {
                "id": "2024-08-21"
            },
            {
                "id": "2024-07-15"
            },
            {
                "id": "2024-07-23"
            },
            {
                "id": "2024-09-10"
            },
            {
                "id": "2024-06-30"
            },
            {
                "id": "2024-07-04"
            },
            {
                "id": "2024-07-12"
            },
            {
                "id": "2024-09-18"
            },
            {
                "id": "2024-09-20"
            },
            {
                "id": "2024-07-05"
            },
            {
                "id": "2024-10-02"
            },
            {
                "id": "2024-07-28"
            },
            {
                "id": "2024-08-25"
            },
            {
                "id": "2024-09-27"
            },
            {
                "id": "2024-08-07"
            },
            {
                "id": "2024-08-13"
            },
            {
                "id": "2024-09-03"
            },
            {
                "id": "2024-09-02"
            },
            {
                "id": "2024-07-16"
            },
            {
                "id": "2024-09-26"
            },
            {
                "id": "2024-08-15"
            },
            {
                "id": "2024-08-10"
            },
            {
                "id": "2024-08-27"
            },
            {
                "id": "2024-08-20"
            },
            {
                "id": "2024-09-17"
            },
            {
                "id": "2024-09-11"
            },
            {
                "id": "2024-08-18"
            },
            {
                "id": "2024-09-23"
            },
            {
                "id": "2024-09-06"
            },
            {
                "id": "2024-08-26"
            },
            {
                "id": "2024-08-12"
            },
            {
                "id": "2024-07-30"
            },
            {
                "id": "2024-08-19"
            },
            {
                "id": "2024-08-08"
            },
            {
                "id": "2024-08-04"
            },
            {
                "id": "2024-07-29"
            },
            {
                "id": "2024-07-24"
            },
            {
                "id": "2024-07-09"
            },
            {
                "id": "2024-09-13"
            },
            {
                "id": "2024-07-14"
            },
            {
                "id": "2024-09-05"
            }
        ]
    },
    "resourceTimeRanges": {
        "rows": [
            {
                "id": "0e8ee270-e246-4ed5-a726-c03c30d30a16",
                "cls": "",
                "name": "OPEN - RDS",
                "color": "#ffd767",
                "endDate": "2024-08-13T16:05:00",
                "alignment": "start",
                "startDate": "2024-08-13T09:00:00",
                "resourceId": "a0e40761-23a2-4f6c-a960-32bb33690548"
            },
            {
                "id": "35f2f8ce-34a3-4b0c-b2a6-6e80e19ae864",
                "cls": "",
                "name": "RECORDS - PRIVATE - Any (No cake)",
                "color": "#f4dcef",
                "endDate": "2024-08-13T17:00:00",
                "alignment": "start",
                "startDate": "2024-08-13T16:40:00",
                "resourceId": "a0e40761-23a2-4f6c-a960-32bb33690548"
            },
            {
                "id": "525252e9-2aee-4390-b12a-5a1cd35fc14d",
                "cls": "",
                "name": "BOND 30 - RDS",
                "color": "#336bdb",
                "endDate": "2024-08-13T16:20:00",
                "alignment": "start",
                "startDate": "2024-08-13T16:05:00",
                "resourceId": "a0e40761-23a2-4f6c-a960-32bb33690548"
            },
            {
                "id": "53a13c9e-6acd-4f62-a3fb-eff3f524bdcb",
                "cls": "",
                "name": "CLOSED",
                "color": "#f70000",
                "endDate": "2024-08-13T09:00:00",
                "alignment": "start",
                "startDate": "2024-08-13T08:35:00",
                "resourceId": "a0e40761-23a2-4f6c-a960-32bb33690548"
            },
            {
                "id": "54af4576-dcc8-440d-8f3a-a56f2a1242b4",
                "cls": "",
                "name": "DEBOND - BTM (Nothing)",
                "color": "#c8c3a2",
                "endDate": "2024-08-13T16:00:00",
                "alignment": "start",
                "startDate": "2024-08-13T14:00:00",
                "resourceId": "5bf9e786-de26-4ec5-8726-8a78380adb40"
            },
            {
                "id": "77763f8c-0b54-4e1c-a050-27a41d22dcd9",
                "cls": "",
                "name": "OPEN - Any (Have breakfast first)",
                "color": "#ffd767",
                "endDate": "2024-08-13T08:35:00",
                "alignment": "start",
                "startDate": "2024-08-13T08:15:00",
                "resourceId": "a0e40761-23a2-4f6c-a960-32bb33690548"
            },
            {
                "id": "994bae14-65eb-44e4-8f8b-45ec217804f1",
                "cls": "",
                "name": "NEW PATIENT PRIVATE - Any (No Debonds or new patients please)",
                "color": "#bff7cb",
                "endDate": "2024-08-13T16:40:00",
                "alignment": "start",
                "startDate": "2024-08-13T16:20:00",
                "resourceId": "a0e40761-23a2-4f6c-a960-32bb33690548"
            }
        ]
    },
    "holidays": {
        "rows": []
    }
}

Post by Animal »

So if, for the date range requested, there were no events for "Chair 1 - Jo", would it still send down the data block for "Chair 1 - Jo", so that that resource still gets into the ResourceStore?


Post by orthobridge »

No, each request sends only what's required. It's rebuilt each time.


Post Reply