Hi...
Actually it works now.
I will paste my script here, just in case anyone else should have a need for
the same feature:
If someone wants to disable let sey fridays in the wicket datepicker
calendar it can be achieved by overriding the
DatePicker getAdditionalJavascript() method.
And if you add this javascript in the getAdditionalJavascript method, the
desired week days should be disabled:
// "cell.innerHTML = '<a href=\"#\" class=\"' +
this.Style.CSS_CELL_OOB + '\">' + this.buildDayLabel(workingDate) +
\"</a>\";\n"
String myRenderer = "var myCustomRenderer = function(workingDate,
cell) {\n"
+ " cell.innerHTML =
this.buildDayLabel(workingDate);\n"
+ " YAHOO.util.Dom.addClass(cell,
'previous');\n"
+ " return
YAHOO.widget.Calendar.STOP_RENDER;\n}";
myRenderer += "\n YAHOO.wicket['" + getComponentMarkupId() +
"DpJs'].addWeekdayRenderer(1, myCustomRenderer);"; // disable sundays
return myRenderer;
This link was a great help:
http://www.stephaniebender.de/extras/yui/examples/calendar/render/1.html
Thanks again Leo...
Best Regards
Muro
On Mon, Nov 23, 2009 at 2:30 PM, Muro Copenhagen <[email protected]>wrote:
> Hi Leo...
>
> Thanks... It helped me further on.
>
> I made it work, in a non-wicket purely javascript version.
>
> But something goes wrong in the wicket datepicker version.
>
> I override the getAdditionalJavascript method for the DatePicker with the
> following:
>
> @Override
> protected String getAdditionalJavascript() {
> String myRenderer = "var myCustomRenderer = function(workingDate,
> cell) {\n"
> + " cell.innerHTML = 'x';\n"
> + " YAHOO.util.Dom.addClass(cell,
> 'disallowed');\n"
> + " return
> YAHOO.widget.Calendar.STOP_RENDER;\n}";
>
> return myRenderer + "\n YAHOO.wicket['" + getComponentMarkupId() +
> "DpJs'].addWeekdayRenderer(1, myCustomRenderer);";
>
> But for some reason i can't associate the customRenderer with the
> datepicker.
>
> Any hint's on how to do that ?
>
> I must admit i am relatively new to wicket.
>
> Thanks in advance.
>
> Muro
>
>
>
> On Fri, Nov 20, 2009 at 9:26 PM, Leo Erlandsson <
> [email protected]> wrote:
>
>>
>> This is certainly possible.
>>
>> You need to use YUI Calendar Renderers. They are documented in the YUI
>> Cal2
>> API Doc. You can find an example of what you are trying to achieve here
>> (thanks Google):
>>
>> http://www.stephaniebender.de/extras/yui/examples/calendar/render/1.html
>>
>> Basically, you'll want to do this for all disallowed weekdays:
>>
>> var myCustomRenderer = function(workingDate, cell) {
>> cell.innerHTML = "X";
>> YAHOO.util.Dom.addClass(cell, "disallowed");
>> return YAHOO.widget.Calendar.STOP_RENDER;
>> }
>> YAHOO.example.calendar.cal1.addWeekdayRenderer(1, myCustomRenderer);
>>
>> This will put an X on all Sundays, making them disabled. Also, it will add
>> a
>> CSS class ('disallowed') that can be customized if you want to change the
>> appearance of disabled cells.
>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Wicket-datepicker-disable-weekdays-tp26444084p26447477.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>