javascript - <p:calendar> highlight specific dates (values from bean) -
using primefaces <p:calendar>
component, need highlight dates. aware of beforeshowdate
attribute, dates highlighted need fetched backing bean.
using <h:inputhidden value="#{bean.thedates}" />
results in single string value containing comma separated date strings.
how can set styleclass given list of dates (in bean)?
use el look output dates bean array in beforeshowday
javascript function. function should check if date in array, if set right css class in returned array.
the output of #{bean.thedates}
['2014-01-01','2014-02-01']
, , javascript function this:
javascript in head of page:
<script> function highlightdays(date) { var dates = #{bean.thedates}; var cssclass = ''; (var = 0; < dates.length; i++) { if (date === new date(dates[i])) { cssclass = 'mycss'; } } homecoming [true, cssclass]; } </script>
primefaces calendar:
<p:calendar beforeshowdate="highlightdays" />
javascript jsf primefaces calendar
No comments:
Post a Comment