My favorites | Sign in
Logo
             
New issue | Search
for
| Advanced search | Search tips
Issue 268: visible attribute of Contextmenu should also support an array of valid node types
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ivan.bozhanov
Closed:  Nov 11
Type-Defect
Priority-Medium


Sign in to add a comment
 
Reported by patrick.wolf123, Nov 04, 2009
Hi,

I have enhanced jquery.tree.contextmenu.js (based on version included in
0.9.9a) to support an array of node types for the visible attribute (like
the valid_children for drag and drop). This should save a lot of coding for
checking visibility of a contextmenu entry.

Maybe someone is interested in this as well. It would be cool if it is
added to the trunk.

Thanks
Patrick
----

Example configuration:

testdrive : {
  label : "Test Drive",
  visible : ["bmw", "audi"],
  action : function (NODE, TREE_OBJ) { alert('hallo'); }
  }

Code change in jquery.tree.contextmenu.js:

In line 45 I have added the following two lines:

/* if visible is not a function and it's an array of valid node types.
Check them against the current node */
if(typeof opts.items[i].visible == "object") r =
($.inArray(t.get_type($.tree.plugins.contextmenu.data.a),
$.makeArray(opts.items[i].visible)) == -1)?-1:1;


jquery.tree.contextmenu.js
7.8 KB   Download
Comment 1 by ivan.bozhanov, Nov 11, 2009
Thank you for the idea - something very similar is implemented on my working copy.
Cheers,
Ivan
Status: Fixed
Owner: ivan.bozhanov
Sign in to add a comment

Hosted by Google Code