Re: Wicket datepicker disable weekdays

2009-11-24 Thread Muro Copenhagen
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 =  '' + this.buildDayLabel(workingDate) +
\"\";\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 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 <
> leo.erlands...@tyringe.com> 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: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>


Re: Wicket datepicker disable weekdays

2009-11-23 Thread Muro Copenhagen
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
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: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Wicket datepicker disable weekdays

2009-11-20 Thread Leo Erlandsson

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: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket datepicker disable weekdays

2009-11-20 Thread Martin Makundi
Or contribute ;)

2009/11/20 Martin Makundi :
> If it is'nt in the yui specs then you might have to hack it.
>
> **
> Martin
>
> 2009/11/20 Muro Copenhagen :
>> Hi Martin,
>>
>> Thanks actually i did...but could not find something...
>>
>> Maybe i have overlooked stuff ?
>>
>> Best Regards
>>
>> Muro
>>
>> On Fri, Nov 20, 2009 at 3:27 PM, Martin Makundi <
>> martin.maku...@koodaripalvelut.com> wrote:
>>
>>> Hi!
>>>
>>> Did you look at the api documentation:
>>>
>>> http://developer.yahoo.com/yui/calendar/
>>>
>>> **
>>> Martin
>>>
>>> 2009/11/20 Muro Copenhagen :
>>> > Hi,
>>> >
>>> > I tried to google for this feature i want without any luck :)
>>> >
>>> > I want to use the wicket datepicker but i want to disable fridays,
>>> saturdays
>>> > and sundays.
>>> >
>>> > Does anyone have a clue on how to achieve this with the datepicker ?
>>> >
>>> > Thanks in advance...
>>> >
>>> > Best Regards
>>> > Muro
>>> >
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>

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



Re: Wicket datepicker disable weekdays

2009-11-20 Thread Martin Makundi
If it is'nt in the yui specs then you might have to hack it.

**
Martin

2009/11/20 Muro Copenhagen :
> Hi Martin,
>
> Thanks actually i did...but could not find something...
>
> Maybe i have overlooked stuff ?
>
> Best Regards
>
> Muro
>
> On Fri, Nov 20, 2009 at 3:27 PM, Martin Makundi <
> martin.maku...@koodaripalvelut.com> wrote:
>
>> Hi!
>>
>> Did you look at the api documentation:
>>
>> http://developer.yahoo.com/yui/calendar/
>>
>> **
>> Martin
>>
>> 2009/11/20 Muro Copenhagen :
>> > Hi,
>> >
>> > I tried to google for this feature i want without any luck :)
>> >
>> > I want to use the wicket datepicker but i want to disable fridays,
>> saturdays
>> > and sundays.
>> >
>> > Does anyone have a clue on how to achieve this with the datepicker ?
>> >
>> > Thanks in advance...
>> >
>> > Best Regards
>> > Muro
>> >
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>

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



Re: Wicket datepicker disable weekdays

2009-11-20 Thread Muro Copenhagen
Hi Martin,

Thanks actually i did...but could not find something...

Maybe i have overlooked stuff ?

Best Regards

Muro

On Fri, Nov 20, 2009 at 3:27 PM, Martin Makundi <
martin.maku...@koodaripalvelut.com> wrote:

> Hi!
>
> Did you look at the api documentation:
>
> http://developer.yahoo.com/yui/calendar/
>
> **
> Martin
>
> 2009/11/20 Muro Copenhagen :
> > Hi,
> >
> > I tried to google for this feature i want without any luck :)
> >
> > I want to use the wicket datepicker but i want to disable fridays,
> saturdays
> > and sundays.
> >
> > Does anyone have a clue on how to achieve this with the datepicker ?
> >
> > Thanks in advance...
> >
> > Best Regards
> > Muro
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Wicket datepicker disable weekdays

2009-11-20 Thread Martin Makundi
Hi!

Did you look at the api documentation:

http://developer.yahoo.com/yui/calendar/

**
Martin

2009/11/20 Muro Copenhagen :
> Hi,
>
> I tried to google for this feature i want without any luck :)
>
> I want to use the wicket datepicker but i want to disable fridays, saturdays
> and sundays.
>
> Does anyone have a clue on how to achieve this with the datepicker ?
>
> Thanks in advance...
>
> Best Regards
> Muro
>

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



Wicket datepicker disable weekdays

2009-11-20 Thread Muro Copenhagen
Hi,

I tried to google for this feature i want without any luck :)

I want to use the wicket datepicker but i want to disable fridays, saturdays
and sundays.

Does anyone have a clue on how to achieve this with the datepicker ?

Thanks in advance...

Best Regards
Muro