Our powerful JS Calendar component


Post 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

Attachments
errorDuplicate.PNG
errorDuplicate.PNG (18.09 KiB) Viewed 414 times

Post 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);
}

Post Reply