Icons in TreeTable
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Sure you can add anything inside a column.
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.
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 --
-
- Posts: 5
- Joined: 23 Mar 2012, 19:24
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
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
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.
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
-
- Posts: 5
- Joined: 23 Mar 2012, 19:24
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>
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>
1. rendered="#{node.type eq 'Category'}"evaluateprimefaces
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
-
- Information
-
Who is online
Users browsing this forum: No registered users and 32 guests