Hello
Is it possible to hide Tree arrows?
We have a need to hide the arrows from the Tree’s first level nodes and to show them all the time, more like a subject lines.
-Timo
Hello
Is it possible to hide Tree arrows?
We have a need to hide the arrows from the Tree’s first level nodes and to show them all the time, more like a subject lines.
-Timo
Try using an ItemStyleGenerator that returns custom style names for the root nodes and then use CSS to hide the background image on those nodes.
I’m trying something similar - I basically want to hide the Tree arrow if the node currently has no children. I understand how to use the ItemStyleGenerator; but I’m struggling with the CSS to hide the background image.
Here is the code for the ItemStyleGenerator:
public class UserTreeItemStyleGenerator implements ItemStyleGenerator
{
protected static final String TREE_NODE_WITHOUT_CHILDREN_STYLE="no-children";
public String getStyle(Object itemId) {
if(container.getChildren(itemId)== null || container.getChildren(itemId).size()==0)
{
return TREE_NODE_WITHOUT_CHILDREN_STYLE;
}
else
{
return null;
}
}
}
and the .css:
.v-tree-node-no-children
{
background: "";
}
However, when I inspect the generated HTML code with Firebug, I see the following:
<div class="v-tree-node-children v-tree-node-children-no-children" style=""></div>
This does not actually hide the tree arrow; Firebug indicates the browser evaluates it as follows:
.v-tree-node .v-tree-node-no-children {
}
styles.css (line 104)
.v-tree-node-expanded {
background-position: -5px -10px;
}
styles.css (line 1963)
.v-tree-node {
background: url("common/img/sprites.png") no-repeat scroll 5px -37px transparent;
padding: 1px 0;
}
Any ideas?
Found it, I had to define the style like this:
.v-tree-node-no-children
{
background: none;
}
This works too,
treetable.setChildrenAllowed(“itemID”, false);
provided you dont want to add any further child to that node.
or else the css method mentioned by Sicco would work too.