-
1. Re: selectDate & convertDateTime
damianharvey Aug 20, 2007 5:53 PM (in response to hager)If you are rendering the selectDate via an ajax call (eg. using ajax4jsf) then you will need to do a few javascript hacks.
If this is the case for you then add this bit of Javascript to your page (it's taken from the selectDate javascript that is called when a page is loaded normally<script type="text/javascript"> //<![CDATA[ //This script block is needed to set Seam Date picker defaults as they don't otherwise get set by AJAX call - only needed on pages where date picker is rendered via AJAX var CAL_DAYS_SHORT = 'Su,Mo,Tu,We,Th,Fr,Sa'; var CAL_DAYS_MEDIUM = 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'; var CAL_DAYS_LONG = 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday'; var CAL_MONTHS_MEDIUM = 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'; var CAL_MONTHS_LONG = 'January,February,March,April,May,June,July,August,September,October,November,December'; var CAL_FIRST_DAY_OF_WEEK = 0; var CAL_DATE_FORMAT = 'dd/MM/yyyy'; //]]> </script>
Cheers,
Damian. -
2. Re: selectDate & convertDateTime
tcavaleiro Aug 25, 2007 6:24 AM (in response to hager)Hi there,
I have a question about the possibility of "overloading" s:selectDate month and weeknames?
I was searching for the subject and I found this ( http://jira.jboss.org/jira/browse/JBSEAM-623 )
It's says- Day and month names are localised as well.
So it seams that there is already a way to redefine the names for a specific language (based on the localization - locale) (correct me if I'm wrong :)
There are any examples??
Best regards,
Tiago. -
3. Re: selectDate & convertDateTime
pmuir Aug 27, 2007 11:34 AM (in response to hager)This is localised through java.text.DateFormatSymbols so I don't think you can arbitrarily override the strings (but read up on DateFormatSymbols).
-
4. Re: selectDate & convertDateTime
tcavaleiro Aug 27, 2007 8:41 PM (in response to hager)Thanks for the reply Pete.
Originally I didn't interpret well what I've read on http://jira.jboss.org/jira/browse/JBSEAM-623 so I didn't understand the right use of s:selectDate.
But after digging on your code (SelectDateRendererBase.java) I got it (how it works...)
I was thinking that s:selectDate needed some sort of *.js locale resource (DateFormatSymbols is powerful).
The truth is that I've define the locale in faces-config.xml like this<locale-config> <default-locale>pt</default-locale> <supported-locale>pt</supported-locale> </locale-config>
and the s:selectDate works very well, but if my s:selectDate is created dynamically through Ajax4JSF the Javascript is transfered but never evaluated.
This is also reported in this thread ( http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035703#4035703 )
and there's a JIRA related ( http://jira.jboss.com/jira/browse/JBSEAM-1156 )
I don't know exactly what is the problem (I've tested with Firefox 2.0.0.6, Opera 9.23 and IE 7 and in all it goes the same. Also [for all] if I made a refresh then the s:selectDate names now appears on portuguese)
Workaround: After putting the next code (through static form) the problem is solved (as is suggested by damianharvey)!!<script type="text/javascript"> // var CAL_DAYS_SHORT = 'Do,Se,Te,Qu,Qu,Se,Sá'; var CAL_DAYS_MEDIUM = 'Dom,Seg,Ter,Qua,Qui,Sex,Sáb'; var CAL_DAYS_LONG = 'Domingo,Segunda-feira,Terça-feira,Quarta-feira,Quinta-feira,Sexta-feira,Sábado'; var CAL_MONTHS_MEDIUM = 'Jan,Fev,Mar,Abr,Mai,Jun,Jul,Ago,Set,Out,Nov,Dez'; var CAL_MONTHS_LONG = 'Janeiro,Fevereiro,Março,Abril,Maio,Junho,Julho,Agosto,Setembro,Outubro,Novembro,Dezembro'; var CAL_FIRST_DAY_OF_WEEK = 1; var CAL_DATE_FORMAT = 'dd/MM/yyyy'; // </script>
Sorry if it went too extensive!
Tiago. -
5. Re: selectDate & convertDateTime
tcavaleiro Aug 28, 2007 9:44 AM (in response to hager)Could you reply Pete and see the JIRA ( http://jira.jboss.com/jira/browse/JBSEAM-1156 )
Thanks!
Tiago. -
6. Re: selectDate & convertDateTime
pmuir Aug 28, 2007 9:48 AM (in response to hager)s:selectDate will soon be deprecated in favour of rich:calendar so use the workaround.
-
7. Re: selectDate & convertDateTime
tcavaleiro Aug 28, 2007 10:07 AM (in response to hager)Ok, thanks for your time Pete!