Hello, I would like to set icons in PrimeFaces tree nodes. My icons are configured in the project CMS. Unfortunately, the Resource Demo doesn't help me.
In <p:treenode> I need to set the icon attribute with a syntax that will retrieve icons from the CMS. asked 15.11.2013 at 12:05 A1234 |
Basically the icon attribute points to a css-class. So if you want to use custom icons you need to create a custom css-class. For example: CSS-Class:
Your code:
The CSS-class will now reference a file that is within the CMS-Folder Images/ and point to an image with name customIconImage (doesn't matter what format). You can also set the width and height within the CSS-class to control the size of the icon via CSS, although this is not recommended because this takes up bandwith when the original sized icon is loaded and afterwards resized. Hope this helps. answered 18.11.2013 at 09:21 Nikel Weis 1
Thanks Nikel, You saved my day! To be precise, I created a CSS file "style.css" in "<project>/webContent", with the CSS-class content you mentioned. Then I added <h:outputstylesheet name="style.css"/> right after the <h:body> tag. And finally, I referenced the icon resource in my <p:treenode> tag. That works.
(18.11.2013 at 10:01)
A1234
1
Better practice would be to place it within the <head>-Tag. But that should be done quickly. Glad to hear, that it helped.
(18.11.2013 at 16:22)
Nikel Weis
Good point! Fixed it. I was inspired by the MethodCallbackDialog in the HtmlDialogDemos project.
(18.11.2013 at 16:33)
A1234
|
Once you sign in you will be able to subscribe for any updates here
By RSS:Markdown Basics
Tags:
Asked: 15.11.2013 at 12:05
Seen: 13,264 times
Last updated: 18.11.2013 at 16:33