Saturday, June 15, 2013

How to set locale for af:chooseDate at runtime?




af:chooseDate Component depend on the region and languages options in the client , so sometime the user need to change that according to his  language, we discuss  how we can set date according to selectedlanguage .


1.by Calendar.getAvailableLocales() function the af:selectOneChoice  display  all available countries   ,first value is the default country.

2.On valueChangeListener event, ChangLocale function will be change default locale to selected country.

FacesContext context = FacesContext.getCurrentInstance
) context.getViewRoot().setLocale(lang




3.af:chooseDate  will revalidate when the user change default country .we set partialTriggers  to countries combox id .





Thanks &Regards
Sameer

No comments:

Post a Comment