Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
196
rated 0 times [  197] [ 1]  / answers: 1 / hits: 15227  / 12 Years ago, wed, august 8, 2012, 12:00:00

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.


More From » jquery

 Answers
31

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.


[#83766] Tuesday, August 7, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tyriquehenryq

Total Points: 248
Total Questions: 81
Total Answers: 105

Location: Bermuda
Member since Thu, Apr 20, 2023
1 Year ago
tyriquehenryq questions
;