I want to set an icon from the CMS on a p:commandButton. How can I achieve this?

asked 06.03.2014 at 14:46

Peter%20St%C3%B6ckli's gravatar image

Peter Stöckli ♦
(suspended)
accept rate: 69%


You can do this by defining a CSS style:

.ui-icon-my{
    background-image: url("#{resource['ivy-cms:images/myIcon']}") !important;
}

and then use it like this on the commandButton:

<p:commandButton actionListener="#{logic.closed}" update="form" value="hallo" image="ui-icon-my" />

Which will then look like this: alt text

link

answered 06.03.2014 at 14:50

Peter%20St%C3%B6ckli's gravatar image

Peter Stöckli ♦
(suspended)
accept rate: 69%

Thank you for the answer Peter! Additionally there is a possibility to get Icons dynamically:

<c:forEach items="#{data.navElems}" var="n"> 
  <p:menuitem value="#{n.description}" icon="#{resource[n.imageUrl]}" /> 
</c:forEach>

The n.imageUrl is like: 'ivy-cms:/nav1/_image'

link

answered 06.03.2014 at 18:01

Alexis's gravatar image

Alexis
(suspended)
accept rate: 66%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×79
×51

Asked: 06.03.2014 at 14:46

Seen: 4,810 times

Last updated: 06.03.2014 at 18:01