Hi, I'm fairly new to jsTree and jQuery so I might be doing something wrong, but I can't seem to update the appearance of an existing node by changing its type.
I'm using the set_type method (3.3.3 syntax with obj first then type) and I've tried calling redraw after but the node's appearance still doesn't change.
Here is an example of my types:
"types" : {
"default" : {
"li_attr":{"class":"black"},
"icon" : false
},
"good" : {
"icon" : "glyphicon glyphicon-arrow-up",
"li_attr":{"class":"black"},
"a_attr":{"title":"<bean:message key='GOOD'/>"}
},
"nogo" : {
"icon" : "glyphicon glyphicon-remove",
"li_attr":{"class":"red"},
"a_attr":{"title":"<bean:message key='NO_GO'/>"}
}
}
And the code I'm trying to change the type with (when a button is clicked, id and newType are set elsewhere):
var lInstance = $('#left').jstree(true);
var lnode = lInstance.get_node(id);
lInstance.set_type(lnode, newType);
lInstance.redraw(true);
Out of interest, if I remove the li_attr from 'good' and I try to change a node from 'good' to 'nogo' with li_attr of class 'red' (color:red) then set_type applies the red colour to the node AND its children but it doesn't change the icon. I wonder if it is only applying new settings but not overwriting settings specified by the old type?
I can't use refresh because the tree is being modified by the user so retrieving the data again will undo the user's changes.
Can you spot what I'm missing?
Thanks.