sure
unread,Jun 1, 2009, 7:26:28 AM6/1/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to jsTree
Hi Ivan,
This is greate updates from you. You have been doing a great
job. I have a problem with context menu With the latest jstree
version, which ever you released recently. It seems to be dosen't work
when i am put a validation for visible or disable option for my custom
context menu items(Site,Domain,Tab,and page). Here is my code. But in
your demos it is working. Here is my code. please let me know where
should i did the mistake.
<code>
$(function()
{
$("#mysites").tree({
data : {
type : "json",
json : [
{ attributes: { id : "pjson1_1", rel : "root" }, state: "open",
data: "Sites",icon:"images/site.png", children : [
{ attributes: { id : "pjson1_2", rel : "folder" }, data: { title :
"Custom icon", icon : "images/channel.png" } },
{ attributes: { id : "pjson1_3", rel : "folder", mdata :
"{ draggable : false, max_children : 2, max_depth : 1 }" }, data:
"Child node 2" },
{ attributes: { id : "pjson1_4", rel : "folder" }, data: "Some
other child node" }
]},
{ attributes: { id : "pjson1_5", rel : "root2" }, data: "Root
node 2" }
]
},
ui:{
dots : true, // BOOL - dots or no dots
rtl : false, // BOOL - is the tree right-to-left
animation : 0, // INT - duration of open/close animations
in miliseconds
hover_mode : true, // SHOULD get_* functions chage focus or
change hovered item
scroll_spd : 4,
theme_path : false, // Path to themes
theme_name : "default",
context : [
{
id : "Site",
label : "Site",
icon : "images/site.png",
visible : function (NODE, TREE_OBJ) {
// return -1 for not visible
if(NODE.attr("id") == "pjson5_2") return -1;
// return false for disabled
if(NODE.attr("id") == "pjson5_3") return false;
// return true for visible and clickable
return true;
},
action : function (NODE, TREE_OBJ) {
// Just a demo of the arguments
alert('"' + NODE.children("a").text() + '" from "' +
TREE_OBJ.container.attr("id") + '"');
}
},
{
id : "Domain",
label : "Domain",
icon : "images/domain.png",
visible : function (NODE, TREE_OBJ) {
// return -1 for not visible
if(NODE.attr("id") == "pjson5_2") return -1;
// return false for disabled
if(NODE.attr("id") == "pjson5_3") return false;
// return true for visible and clickable
return true;
},
action : function (NODE, TREE_OBJ) {
// Just a demo of the arguments
alert('"' + NODE.children("a").text() + '" from "' +
TREE_OBJ.container.attr("id") + '"');
}
},
{
id : "Tab",
label : "Tab",
icon : "images/folder.png",
visible : function (NODE, TREE_OBJ) {
// return -1 for not visible
if(NODE.attr("id") == "pjson5_2") return -1;
// return false for disabled
if(NODE.attr("id") == "pjson5_3") return false;
// return true for visible and clickable
return true;
},
action : function (NODE, TREE_OBJ) {
// Just a demo of the arguments
alert('"' + NODE.children("a").text() + '" from "' +
TREE_OBJ.container.attr("id") + '"');
}
},
{
id : "Page",
label : "Page",
icon : "images/page.png",
visible : function (NODE, TREE_OBJ) {
// return -1 for not visible
if(NODE.attr("id") == "pjson5_2") return -1;
// return false for disabled
if(NODE.attr("id") == "pjson5_3") return false;
// return true for visible and clickable
return true;
},
action : function (NODE, TREE_OBJ) {
// Just a demo of the arguments
alert('"' + NODE.children("a").text() + '" from "' +
TREE_OBJ.container.attr("id") + '"');
}
}
]
},
rules : {
metadata : "mdata",
use_inline : true,
clickable : [ "root2", "folder" ],
deletable : "none",
renameable : "all",
creatable : [ "folder" ],
draggable : [ "folder" ],
dragrules : [ "folder * folder", "folder inside root", "tree-drop
inside root2" ],
drag_button : "left",
droppable : [ "tree-drop" ]
}
});
});
</code>
with Regards
sure