最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Primefaces: how to change the default icon on the button of the calendar field? - Stack Overflow

programmeradmin9浏览0评论

In Primefaces, how do I change the icon that is being used by the button of the calendar field?

For example, in the following field

<p:calendar value="#{calendarBean.date3}" id="popupButtonCal" showOn="button" />

I want to change the icon to .gif.

I've looked at the documentation, but I cannot find an attribute for this.

UPDATE:

I have tried the following, with partial success:

JSF:

<p:mandButton id="modalDialogButton" value="" onclick="dlg2.show();" type="button" icon="ui-calendar"/>

CSS:

.ui-widget .ui-calendar {

    background-image: url(#{resource['images:country_flag.gif']});
}

PROBLEMS:

  1. I do see the image on the p:mandButton button now. But, I am getting the warning message:

    Apr 03, 2012 10:43:58 AM .sun.faces.application.resource.ResourceHandlerImpl logMissingResource WARNING: JSF1064: Unable to find or serve resource, images/country_flag.gif.jsf.

  2. I could not find a css style on the p:calendar that I should override in order to change the image on the calendar button.

In Primefaces, how do I change the icon that is being used by the button of the calendar field?

For example, in the following field

<p:calendar value="#{calendarBean.date3}" id="popupButtonCal" showOn="button" />

I want to change the icon to http://forum.primefaces/images/smilies/icon_e_wink.gif.

I've looked at the documentation, but I cannot find an attribute for this.

UPDATE:

I have tried the following, with partial success:

JSF:

<p:mandButton id="modalDialogButton" value="" onclick="dlg2.show();" type="button" icon="ui-calendar"/>

CSS:

.ui-widget .ui-calendar {

    background-image: url(#{resource['images:country_flag.gif']});
}

PROBLEMS:

  1. I do see the image on the p:mandButton button now. But, I am getting the warning message:

    Apr 03, 2012 10:43:58 AM .sun.faces.application.resource.ResourceHandlerImpl logMissingResource WARNING: JSF1064: Unable to find or serve resource, images/country_flag.gif.jsf.

  2. I could not find a css style on the p:calendar that I should override in order to change the image on the calendar button.

Share Improve this question edited Apr 3, 2012 at 15:59 rapt asked Apr 2, 2012 at 17:41 raptrapt 12.2k36 gold badges110 silver badges155 bronze badges 7
  • replace default image with yours – safarov Commented Apr 2, 2012 at 18:09
  • Thanks. But I would not like to change the primefaces jar. – rapt Commented Apr 2, 2012 at 18:12
  • @Cagatay Civici could you please provide an example/link? Thanks. – rapt Commented Apr 3, 2012 at 13:32
  • how about this approach stackoverflow./a/512067/617373 – Daniel Commented Apr 3, 2012 at 16:02
  • you tried it with el expression in css file which cannot be done... in the link they do it with jquery... – Daniel Commented Apr 3, 2012 at 18:02
 |  Show 2 more ments

1 Answer 1

Reset to default 4

try this

.ui-icon-calendar {
    background-image: <your URL> !important;
    background-position: center center !important;
    width: 16px;
    height: 16px;
}
发布评论

评论列表(0)

  1. 暂无评论