Ask questions and get good answers on jQuery

I’m trying to use this menu as a context menu for a file tree, so it needs to know the current file so that it can work out what options to show and also be aware of current state for copy operations.

I tried to use the additionalData but it looks like that only evaluates when you build the page. How do I make it work for dynamic data/Context from the web page.

asked Nov 23 '09 at 22:30

Dan's gravatar image

Dan
111


there’s a global variable setted to the $.menu object that returns the last contextualmenu element you clicked on:

$.mbMenu.lastContextMenuEl.

Try this function applied onContextualMenu callback:

//this function get the id of the element that fires the context menu.
  function testForContextMenu(el){
  if (!el) el= $.mbMenu.lastContextMenuEl;
  alert("the ID of the element is: "+$(el).attr("id"));
}

answered Nov 23 '09 at 22:32

Matteo%20Bicocchi's gravatar image

Matteo Bicocchi ♦♦
1776129

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×3
×1

Asked: Nov 23 '09 at 22:30

Seen: 471 times

Last updated: Aug 03 '10 at 10:23

jQuery main site - Matteo Bicocchi