Our pure JavaScript Scheduler component


Post by eyvind »

Hi,

Thanks for all the great help I have received on this forum so far.

This time I wish to trigger the Time Axis Header Menu from a button click on a custom button, instead of (or rather in addition to) right-cliking the scheduler header. Is this possible to achieve?

Thanks!

Best regards,
Eyvind


Post by mats »

No such API currently, for now you could just mimic a right click:

const evt = new MouseEvent('contextmenu', { bubbles : true });
    scheduler.element.querySelector('.b-sch-header-timeaxis-cell').dispatchEvent(evt);

Post by eyvind »

Thank you for the reply - this works! However, the menu shows up in the top-left corner of the screen; do you know of a good way to have it show up in a position relative to the button that is clicked? I know this might be a css issue, but I thought I would ask :)


Post by alex.l »

Hi eyvind,

Try to position the menu after first init using scheduler.features.timeAxisHeaderMenu.menu.showBy method.
Here is docs: https://www.bryntum.com/docs/scheduler/#Core/widget/Widget#function-showBy

All the best,
Alex

All the best,
Alex


Post by eyvind »

Hi Alex,

Thank you for your reply.

I am trying to run the showBy function in ngAfterViewInit:

ngAfterViewInit() {
    this.scheduler.schedulerInstance.features.timeAxisHeaderMenu.menu.showBy({spec: {target: "timeAxisButton"}})
}

However, I get the error:

ERROR TypeError: Cannot read property 'showBy' of undefined at CalendarComponent.ngAfterViewInit

Do you what I might be doing wrong?

Thanks!


Post by mats »

What version are you using?


Post by alex.l »

HI eyvind,

I double-checked that now. I am sorry, but this feature does not support manual menu expanding now. There is no way to init the menu with not right-click way. So, it works only if the menu has been shown once using regular right click.
I've opened a feature request to add this functionality https://github.com/bryntum/support/issues/2378
Unfortunately, there is no quick workaround now.

All best,
Alex

All the best,
Alex


Post by eyvind »

Ok, thank you!

(I am using Angular 10 and Scheduler 4.0.0)


Post Reply