Calendar "OnChange" Changeset not an array

  • Goal: Run a "Bulk Update via Primary Key" OR a "Update an existing record" with the changeset of the Calendar component.

  • Steps:

  1. Created a calendar and added data.
  2. Created an "On Change" event tied to a "bulk update via primary key" SQL
  3. Set the SQL array to calendar.changeset
  • Details: The issue is that the change-set is an object not an array. I can run it through a transformer but that seems like unnecessary extra steps. Shouldn't the change-set act similar to the table component?

What is the recommended way to setup a Calendar component with on change events? The demo linked in the documentation seems to work well, but the docs are not descriptive enough to see what is going on.

@kyleteal
The name of the event in the Calendar component is "ChangeEvent," not "ChangeEvents," implying that it pertains to the alteration of a single event at a time. Therefore, in your query, the action type should be "Update an existing record" rather than "Bulk update via a primary key".

1 Like

Got it, I appreciate the reply!

I had tried that but unfortunately {{eventsCalendar.changeset}} returns this object

{
  "5f6c9de3-1e19-4f6c-b278-0dc7d34e42f8": {
    "allDay": true,
    "start": "2025-02-24T06:00:00.000Z",
    "end": null,
    "id": "5f6c9de3-1e19-4f6c-b278-0dc7d34e42f8"
  }
}

and the key is not static, so I used this

{{ Object.values(eventsCalendar.changeSet)[0] }} which returns the values of that object

{
  "allDay": true,
  "start": "2025-02-24T06:00:00.000Z",
  "end": null,
  "id": "5f6c9de3-1e19-4f6c-b278-0dc7d34e42f8"
}

But unfortunately those keys do not match my database schema, so a transformer will be needed anyways it seems. It would be great if the keys matched the inputs, for example in the calendar start input I have {{ item.event_start }} so ideally the changeset would inherit that event_start instead of start. This is how the table works I believe. But I will make do with it as implemented.

Thank you,

1 Like

Thanks for reaching out about this! I agree it's a notably more work than the table implementation.

As you noted, a transformer works :slightly_smiling_face:. You could also put Javascript directly into the query changeset

1 Like