Premium support for our pure JavaScript UI components


Post by peterjc »

Hi, I have the following version of the scheduler....

"@bryntum/scheduler": "5.6.1",
"@bryntum/scheduler-angular": "5.6.1",

I use the Angular wrapper, and I set the event context menu (as well as many other properties) as follows...

markup

<bryntum-scheduler #scheduler 
   ...
   [eventMenuFeature]="eventContextMenu" 

Code behind

 public eventContextMenu: Partial<EventMenuConfig> = {
    items: {
      // Remove default items
      deleteEvent: false,
      unassignEvent: false,
      editEvent: false,
      addEvent: false,
      copyEvent: false,
      cutEvent: false,

  // Custom Edit 
  edit: {
    text: this.getEditMenuItem(),
    cls: 'custom-menu-item',
    onItem: (item) => {
      this.showEditModal((item as any).eventRecord as SchedulerEventModel, false);
    }
  },

etc

I now have the case where I want to add or remove some items depending on user permissions.

I did try just updating (e.g. inserting items into) eventContextMenu at runtime, but, the menu did not update. I assume this is just read once at instantiation.

So, my question is can I set this eventMenuFeature in code after the scheduler has been instantiated.
This will happen after instantiation, as some of my permission calls are asynchronous.

Thanks in advance for any help.


Post by mats »


Post by peterjc »

Thankyou mats, works perfect!


Post Reply