I have been searching the interent for an age and couldnt find an answer. I was trying to change node text colour dependant on the type of the particular node. So in this example i wanted to change the text colour of every node that is a "Role" type defined in data.
$("#roleTree").jstree({
json_data: {
data: roleTreeData
},
"themes": {
"theme": "default",
"dots": true,
"icons": false
},
"ui": {
"select_limit": 1,
"select_multiple_modifier": "none"
},
"types": {
"types": {
"AM": {
"hover_node": false,
"select_node": false
},
"AF": {
"hover_node": false,
"select_node": false
},
"Role": {
// i dont know if possible to be done here? add class?
// this.css("color", "red")
//{ font-weight:bold}
}
}
},
plugins: ["themes", "json_data", "ui", "Select", "types", "crrm"]
}).bind("loaded.jstree", function (event, data)
{
$("#roleTree").jstree("open_all");
data.inst.select_node('ul > li:first');
}).bind("select_node.jstree", function (event, data)
{
selectedRoleId = data.rslt.obj.attr("id");
window.selectedRole = GetRole(selectedRoleId);
});
}
Or any other method to highlight or tell users that only the role is selectable.
This can be done using the following CSS, assuming you are using the default classic theme.
.jstree-classic li[rel="Role"] > a { color:red; }
Get jstree-classic
class, where child li
has rel
attribute of Role
, get the first child a
of that li
and assign color to red.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With