Basically, I have a jsTree, and I need to format it’s li and a DOM elements by adding custom class to each type. The documentation is not clear on how to do this and as far as I can tell, there is no way to add custom class, any formating will have to be by overriding jquery theme or by editng the jsTree source-code. I am ok with either doing it in the JSON data, or more effectively, when declaring the “types” as shown in the example here:
$("#container").jstree({
"plugins" : ["themes", "json_data", "ui", "themeroller", "types"],
"json_data" : {"data": my_json_data},
"core" : {
"initially_select" : [ init_id]
},
"types" : {
"valid_children" : [ "test_type" ],
"types" : {
"test_type" : {
"valid_children" : [ "default", "test_type" ],
"icon" : { "image" : "/includes/icon.gif"}
}
}
},
"themes" : {
"dots" : true,
"icons" : true
}
});
If you want to do it in the JSON response, this works for me:
The first attr refers to the
<li>tag, and the second attr (inside data) refers to the<a>tag.