Re: How can override calendar formatting at initialization using DatePicker? getAdditionalJavascript not always working...

2010-06-10 Thread rawe

Yes, I solved it!
When displaying the calendar the first time it's mandatory to call its clear
method
(Clears the selected dates in the current calendar widget and sets the
calendar to the current month and year. )

My solution:

@Override
protected String getAdditionalJavascript() {
if (additionalJavascript == null)
additionalJavascript = ;

StringBuilder sb = new StringBuilder();

sb.append(${calendar}.addRenderer(\6/10\,
${calendar}.renderBodyCellRestricted););
sb.append(${calendar}.clear(););

additionalJavascript += sb.toString();

return additionalJavascript;
} 
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-can-override-calendar-formatting-at-initialization-using-DatePicker-getAdditionalJavascript-not--tp1880352p2250102.html
Sent from the Wicket - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How can override calendar formatting at initialization using DatePicker? getAdditionalJavascript not always working...

2010-06-04 Thread rawe

I got the same problem!
Did you solve it already?
If yes, I would be glad to get some help!

I just disabled the weekend days in DatePicker by overriding the method

@Override
protected String getAdditionalJavascript() {

additionalJavascript += ${calendar}.addWeekdayRenderer(1,
${calendar}.renderOutOfBoundsDate);; // disable sundays
additionalJavascript += ${calendar}.addWeekdayRenderer(7,
${calendar}.renderOutOfBoundsDate);; // disable saturdays

return additionalJavascript;
}

It works, but not when displaying the DatePicker first time. Just after I
did some action in it. (e.g. changing the month)

Thank you!

Ralph

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-can-override-calendar-formatting-at-initialization-using-DatePicker-getAdditionalJavascript-not--tp1880352p2243002.html
Sent from the Wicket - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



How can override calendar formatting at initialization using DatePicker? getAdditionalJavascript not always working...

2009-02-17 Thread Jen Van Orman
I am overriding the DatePicker class in order to limit the calendar to 3
months, and I also want to disable the 1st through 4th of each month.

My override of getAdditionalJavascript does the following adds a renderer to
these dates as an OutOfBoundsDate:
*

for*( *int* i = minCal.get(Calendar.*MONTH*); i = maxCal.get(Calendar.*
MONTH*); i++){

javascript += ${calendar}.addRenderer(\ + (i + 1) + /1\,
${calendar}.renderOutOfBoundsDate);;

javascript += ${calendar}.addRenderer(\ + (i + 1) + /2\,
${calendar}.renderOutOfBoundsDate);;

javascript += ${calendar}.addRenderer(\ + (i + 1) + /3\,
${calendar}.renderOutOfBoundsDate);;

javascript += ${calendar}.addRenderer(\ + (i + 1) + /4\,
${calendar}.renderOutOfBoundsDate);;

...

However, the renderer doesn't work when the calendar is initially shown.
For example, if the pageDate of the calendar is set to 03/2009, the 1st
through the 4th will be enabled, but the 1st through the 4th of April and
May will be disabled, as expected.  When navigating back to March, the 1st
through the 4th are then disabled.  Also, closing the calendar and reopening
it disables the 1st through the 4th.

With appendToInit being deprecated, how can these renderers be added to the
initialization of the calendar?

Any help is greatly appreciate.

Thanks,

Jen Van Orman






-- 
Quis custodiet ipsos custodes?