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

events.update updates the whole calendar and not the only event, causing flickering.

Asked by Anonymous
8 months ago.
      const id = pickedEvent !== undefined ? pickedEvent.e.data.id : "-1";
        let event = calendarRef.current!.control.events.find(id);
        // console.log("E' QUI CHE DIVENTA 1");

        if (event !== null) {
          const clientId = event?.data.tag.client_id;
          // console.log("[DAYPILOT] UPDATE");

          // console.log("NOTE", note);

          calendarRef.current!.control.events.update({
            id: id,

            text: pickedService[0].service.id_service,
            start: pickedService[0].date!["start"],
            end: pickedService[0].date!["end"],
            resource: pickedService[0].resource.id,
            cssClass: "draft_event",
            barHidden: true,
            tag: {
              marker: pickedService[0].service.ec_color_light,
              client:
                (watchFields.name ?? "Passaggio ") +
                " " +
                (watchFields.surname ?? gender),
              service: pickedService[0].service.name,
              writtenNote: note,
              note: note !== undefined,
            },
          });

Why this code causes flickering in all the calendar when called? I would like only the event to be updated, but everything is redrawn.

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

There was an issue with events.update() when called with a raw data object as an argument. It should be fixed now in the latest sandbox build (2023.4.5743). It caused the calendar to update the events twice.

See also: https://release.daypilot.org/changes/js/

Now the performance should be comparable to the update that is performed when an event is dropped at a new location.

All events are always updated when calling events.update(). Since the viewport is limited this shouldn’t cause any flicker. Further optimizations would only be possible for cases when the event position (start, end, resource) doesn’t change.

Please let me know if the problem persists.

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