Icons in TreeTable

UI Components for JSF
Post Reply
sebek
Posts: 38
Joined: 19 Jul 2011, 18:56

19 Oct 2011, 16:50

Is it possible to add icons to treeTable nodes like in the tree component?
-- PrimeFaces 3.3-SNAPSHOT -- Mojarra 2.1.2 -- Tomcat 7.0.19 --

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

19 Oct 2011, 16:54

Sure you can add anything inside a column.

sebek
Posts: 38
Joined: 19 Jul 2011, 18:56

19 Oct 2011, 17:05

I was thinking about adding the icon as part of the node. Its behavior would mimic nodes like in the tree component.
They are exactly the same object in the backend.

But, adding icon to the column will work as well.

Thanks, again for your help.
-- PrimeFaces 3.3-SNAPSHOT -- Mojarra 2.1.2 -- Tomcat 7.0.19 --

evaluateprimefaces
Posts: 5
Joined: 23 Mar 2012, 19:24

23 Mar 2012, 21:13

Hi
Is this working for you? i.e. adding icons to a tree node in TreeTable component?
If yes, can you please share the code?

Thanks

rkrenn
Posts: 33
Joined: 26 Jul 2011, 03:55
Location: Austria

25 Mar 2012, 21:11

it works, see for example viewtopic.php?f=3&t=16791&p=61367#p61367

i used an aditional <span> with css class for each icon; the icon image itself is the css background-image. you can look into code if you explore this pattern in primefaces with firebug, eg. the icons of the tree-component from showcase.
Mojarra 2.1.28, PrimeFaces 3.3.1, Primefaces Extensions 0.7.0, libservlet3.1-java tomcat8, openjdk-8-jdk

evaluateprimefaces
Posts: 5
Joined: 23 Mar 2012, 19:24

26 Mar 2012, 05:27

Sooper...Thanks for the clue :)
I used the <span> tag, but i wanted to show the icon conditionally.
So, instead i used a graphicImage tag.

Here's what i did...and i was able to show icons to the nodes in a treetable.


<p:column style="width:150px">
<f:facet name="header">Category</f:facet>
<p:graphicImage styleClass="ui-treetable-toggler ui-icon ui-icon-folder-collapsed" rendered="#{node.type eq 'Category'}"/>
<p:graphicImage styleClass="ui-treetable-toggler ui-icon ui-icon-document" rendered="#{node.type eq 'Element'}"/>
<h:outputText value="#{node.categoryName}"/>
</p:column>

vanuatoo
Posts: 32
Joined: 22 Jan 2012, 12:17

14 May 2012, 08:09

evaluateprimefaces
1. rendered="#{node.type eq 'Category'}"
where node var is coming from? how do you define it?
2. Could you please provide also a fragment from java code, how you define type of a node?
NetBeans 11.2, Payara 5.193.1, PrimeFaces 6.2.27, Mojarra 2.3.9

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 32 guests