search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Setting custom context Menu.

Asked by John
7 years ago.

Using dp.onBeforeEventRender I have a switch based on a variable "status". I would like my context menu to be different for each one of these cases.

args.e.contextMenuClientName seems to be the way to set this menu. But i am unable to get it to work. Here is a simplified version of my code:

var menuTest = new DayPilot.Menu([
{text:"Customer quick view", onclick: function() { loadCustomerInfo(this.source.value());} },
{text:"Guest checked in", onclick: function() {update_reservation_status('Checked in',this.source.value()); } },
{text:"Guest checked out", href: "edit2.php?id={0}"},
{text:"Cancel reservation", href: "cancel.php?q={0}"},
{text:"Lock/unlock reservation", onclick: function() {update_reservation_status_lock('lockchange',this.source.value()); } }
menuTest.clientObjectName = "test";

dp.onBeforeEventRender = function(args) {
switch (args.e.status) {
case "Confirmed":
args.e.contextMenuClientName = "test";

Answer posted by Jo
7 years ago.

Do this instead - worked for me:

args.e.contextMenu = "test";

Comment posted by Anonymous
7 years ago.

Hi Jo, so this is working in so much that i can see it is part of the event object, however I can't see the menu when I right click

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.