How to display custom task menu when I right click a particular date icon?
For example, if column is StartDate and record is Leaf, display the following task menu items only.
The $ jquery code does not work in React Typescript. Is there any other way?
taskMenuBeforeShow({ taskRecord, event }) {
// Hide all visible context menus
$('.dropdown-menu:visible').hide();
// Set data, set position, and show custom task menu
$('#customTaskMenu').data({
taskId : taskRecord.id
}).css({
top : event.y,
left : event.x
}).show();
// Prevent built in task menu
return false;
}
Re: [REACT] Custom task menu
Posted: Fri Mar 31, 2023 9:33 pm
by marcio
Hey,
We recommend using JQuery for that purpose, but you could try a workaround with Vanilla JS like this
taskMenuBeforeShow({ taskRecord, event }) {
const menu = document.querySelector('.dropdown-menu');
menu.dataset.taskId = taskRecord.id;
menu.style.top = event.y;
menu.style.left = event.x;
menu.style.display = 'block';
// Prevent built in task menu
return false;
}
Re: [REACT] Custom task menu
Posted: Mon Apr 03, 2023 7:41 am
by rodel.ocfemia
Hi,
I tried the following but the custom task menu is not displaying. When I tried to console.log($(customMenuHtml).html()), the div content is displayed.
This is the workaround I made to create a custom menus. This will work for now since I only need to display two custom menus. But If the menus are dynamic, is there a way to add multiple custom menu object to items object without overriding the existing menus?