How to avoid setting styleClass of children when applying styleClass of a TreeNode
How to avoid setting styleClass of children when applying styleClass of a TreeNode?
Part of the tree node structure looks like this --
"label": "My parent Node",
"data": {
"id": 145336,
},
"expandedIcon": "fa-minus-square",
"collapsedIcon": "fa-plus-square",
"icon": null,
"leaf": false,
"droppable": null,
"draggable": null,
"expanded": true,
"*styleClass": "movedNodeClass",
"children": [{
"label": "My Child Node-1",
"data": {
"id": 3025,
},
"expandedIcon": null,
"collapsedIcon": null,
"icon": "fa-leaf",
"leaf": true,
"droppable": null,
"draggable": null,
"expanded": null,
"styleClass": null,
"children": [],
"parent": null
}, {
"label": "My Child Node-2",
"data": {
"id": 3030,
},
"expandedIcon": null,
"collapsedIcon": null,
"icon": "fa-leaf",
"leaf": true,
"droppable": null,
"draggable": null,
"expanded": null,
"styleClass": null,
"children": [],
"parent": null
}],
"parent": null
}],
"parent": null
},
Current behavior The parent node has styleclass set as "movedNodeClass", which looks like
.movedNodeClass .ui-treenode-content { background-color: coral; color: black; }
Notice that 2 children have styleclass set as null. But still, the styleclass of parent, gets applied to both the children. How to avoid that? I want the styleclass applied just to parent, not the child.
Note: the setting of encapsulation is - encapsulation: ViewEncapsulation.None
Expected behavior I want the styleclass applied just to parent, not the child.
.movedNodeClass > .ui-treenode-content {
background-color: coral;
color: black;
}
@cagataycivici that didn't fix anything. In fact, I lost the styles on all nodes. Issue still not resolved. Would appreciate if you/anyone has any suggestions. Thanks.
Any resolution on this? This behavior is causing issues for me as well.
Hi, I'm stuck at the exact same problem. Does anyone have a solution to this?
I have the issue that styleClass is not applying at all, nor to parents.