Our pure JavaScript Scheduler component


Post by sactory »

Hello guys,

I want to right click on event in scheduler to show tooltip (intead hover on it) like this.

Or custom :event-menu-feature to show a template HTML.

Can you help me, please!

Attachments
Screen Shot 2021-10-13 at 10.02.54.png
Screen Shot 2021-10-13 at 10.02.54.png (373.06 KiB) Viewed 1135 times

Post by alex.l »

The easiest way I see here is to catch https://bryntum.com/docs/gantt/api/Gantt/feature/TaskMenu#event-taskMenuBeforeShow and return false for cases when you want to see that custom tooltip instead of menu.

That handler has taskElement you can use for positioning your popup/tooltip. Here is docs how to show tooltip https://bryntum.com/docs/gantt/api/Core/widget/Tooltip

All the best,
Alex


Post by sactory »

Thank you, but i want to show a template of HTML in menu (event-menu-feature Scheduler) (only show info, it is not a menu) like

Screen Shot 2021-10-13 at 14.21.33.png
Screen Shot 2021-10-13 at 14.21.33.png (152.18 KiB) Viewed 1127 times

But i can custom html in processItems, here is menu and my code:

Screen Shot 2021-10-13 at 14.22.19.png
Screen Shot 2021-10-13 at 14.22.19.png (27.81 KiB) Viewed 1127 times
Screen Shot 2021-10-13 at 14.22.41.png
Screen Shot 2021-10-13 at 14.22.41.png (141.85 KiB) Viewed 1127 times

I found eventMenuBeforeShow but it not working. Please help me! Thanks


Post by sactory »

Or How can i turn on my tooltip by right click on a Job in Scheduler?

Attachments
Screen Shot 2021-10-13 at 14.22.19.png
Screen Shot 2021-10-13 at 14.22.19.png (27.81 KiB) Viewed 1120 times

Post by Animal »

So multiple things.

If you do not want a context menu, disable that feature. Then reconfigure the eventTooltip feature to do as you want:

features : {
        eventMenu    : false,
        eventTooltip : {
            forSelector : false,
            showOnHover : false
        }
    },
    listeners : {
        eventContextMenu({ event, eventElement }) {
            event.preventDefault();

            // Call the tooltip's "over" handler on the context menu event
            scheduler.features.eventTooltip.tooltip.handleForElementOver(event, eventElement)
        }
    }

That will get it showing on context menu.

Then you can add your template to change what it shows. I believe there are examples of how to do that.


Post by sactory »

Thank you, but can you show me the eventTooltip.tooltip config?
Please help me.

Attachments
Screen Shot 2021-10-14 at 09.19.53.png
Screen Shot 2021-10-14 at 09.19.53.png (89.72 KiB) Viewed 1107 times

Post by sactory »

It is the same config, so i call:
schedulerConfig.features.eventTooltip.handleForElementOver
or schedulerConfig.features.eventTooltip.tooltip.handleForElementOver
I still get: Uncaught TypeError: schedulerConfig.features.eventTooltip.tooltip.handleForElementOver is not a function

My version: 4.0.8


Post by sactory »

Thank you, i resolve this problem.


Post by Animal »

FYI, the configuration of the Feature is passed into the configuration of its tooltip, so you just need

features : {
    eventTooltip : {
        forSelector : false,
        allowOver : true,
        scrollAction : 'hide',
        template : async({}) => { ... }
    }
}

newInstance is only for the tooltip config on Widgets. This always gets its own instance.


Post Reply