PDA

View Full Version : is it possible to put multiples icons beside each other on tree nodes



flamant
16 Feb 2011, 10:59 AM
Hi,
There is a property for asynctreenode for setting an icon class. This way you can put one icon on a node.

But is it possible to put multiples icons beside each other on tree nodes

I set the properties of the nodes on the server side this way :



jsonObject = new JSONObject();
jsonObject.put("text", node.getName());
jsonObject.put("id", node.getEntityName() +"[" + node.getCompositeId() + "]");
jsonObject.put("leaf", node.isLeaf());
jsonObject.put("cls", node.getCls());
jsonObject.put("iconCls", node.getIcon());
jsonObject.put("mode", node.getMode(grantedAuthorities));
jsonObject.put("checked", node.getChecked());
jsonObject.put("entityId", node.getoID());
jsonObject.put("entityName", node.getEntityName());
jsonObject.put("subEntityName", node.getSubEntityName());
jsonObject.put("subPath", node.getSubPath());
jsonObject.put("targetDivId", targetDivId);
jsonObject.put("allowedActions", node.getAllowedActions(grantedAuthorities));
jsonObject.put("singleClickExpand", true);


Thank you in advance for your answers

flamant
17 Feb 2011, 2:32 AM
I tried to add a class the following way



node.getUI().addClass('signed');


But the corresponding icon is placed at the left of the node line

Should I manipulate the dom itself to implement it ?

Condor
17 Feb 2011, 2:44 AM
You have 2 options:
1. Create a TreeNodeUI descendant that renders multiple icons.
2. Use single images that hold multiple icons and use a css rule to widen the image tag.

flamant
17 Feb 2011, 3:12 AM
Hi condor and thank you for your answer,

In my case I would prefer to Create a TreeNodeUI descendant that renders multiple icons.

But I am lost on how to implement it

Condor
17 Feb 2011, 5:42 AM
You would create a TreeNodeUI descendant and override the renderElements method.

Search the forum for 'renderElements' and you'll probably find some examples.