Page 1 of 1

[ANGULAR] Error when apply Duplicate Event

Posted: Mon Jun 14, 2021 12:00 pm
by SHQK

Hi Bryntum team,
I download the filtering demo with latest version (4.1.5) and try to apply Duplicate Event in example called "Customized context menus"

    features : {
        eventEdit : {
            items : {
                location : {
                    type    : 'text',
                    name    : 'location',
                    label   : 'Location',
                    dataset : { eventType : 'Meeting' }
                }
            }
        },
        eventMenu: {
          items: {
            duplicateEvent: {
                  text :  `<div style="margin-top: 5px">
                              Duplicate Event
                          </div>`,
                  icon: 'b-fa b-fa-clone',
                  weight: 100,
                  onItem : 'up.duplicateEvent'
              }
          }
      }
    },

duplicateEvent({ eventRecord }) {
  const dupe = eventRecord.copy();

  // In case it was a recurring event, the dupe will be a one-off.
  dupe.recurrence = null;
  this.eventStore.add(dupe);

But when I click "Duplicate Event" in Event Menu,
There was an error described in the attached file


Re: [ANGULAR] Error when apply Duplicate Event

Posted: Mon Jun 14, 2021 12:33 pm
by saki

Where did you put the above features? The features have to be suffixed with Feature word in Angular as described here: https://bryntum.com/docs/calendar/#Calendar/guides/integration/angular.md#features

Also, onItem:'up.duplicateEvent' expects the handler to be installed on the native calendar instance, which isn't the case here. You will need to have a handler that resolves to a function, for example an inline function:

onItem(e): {
    duplicateEvent(e);
}