In the second loop try:

return [true, 'desocupa'];

On Fri, Jan 30, 2009 at 8:50 AM, Led <[email protected]> wrote:

>
> now i have another problem. This code
> function ocupaDays(date) {
>    for (i = 0; i < arrayOcupado.length; i++) {
>      if (date.getMonth() == arrayOcupado[i][0] - 1
>          && date.getDate() == arrayOcupado[i][1]
>          && date.getFullYear() == arrayOcupado[i][2]) {
>        return [false, 'ocupa' ];
>
>      }
>    }
>  for (i = 0; i < arrayLivre.length; i++) {
>      if (date.getMonth() == arrayLivre[i][0] - 1
>          && date.getDate() == arrayLivre[i][1]
>          && date.getFullYear() == arrayLivre[i][2]) {
>        return [false, 'desocupa' ];
>
>      }
>    }
>
>  return [true, ''];
>
> }
>
> the css only work if the class 'desocupa is selectable=false. I need
> to apply the css rule that is background color : green and turn it
> selectable. try the sample and choose february.
> http://www.realferias.com/datepik.asp?cod_casa=15
>
> On Jan 29, 6:58 am, Ca-Phun Ung <[email protected]> wrote:
> > > > $("#Text1").datepicker({ beforeShowDay:
>  nationalDays,showOtherMonths:
> > > > true,showWeeks: true, firstDay: 7,changeFirstDay: false});
> >
> > > > function nationalDays(date) {
> > > >     for (i = 0; i < natDays.length; i++) {
> > > >       if (date.getMonth() == natDays[i][0] - 1
> > > >           && date.getDate() == natDays[i][1]
> > > >           && date.getFullYear() == natDays[i][2]) {
> > > >         return [false, natDays[i][0][1] ];
> >
> > > >         $(".ui-datepicker-days-cell").addclass("desocupa");
> >
> > > > }
> >
> > > >     }
> > > >   return [true, ''];
> >
> > Ah I see what you're trying to do now. Try this:
> >
> > function nationalDays(date) {
> >   for (i = 0; i < natDays.length; i++) {
> >     if (date.getMonth() == natDays[i][0] - 1
> >         && date.getDate() == natDays[i][1]
> >         && date.getFullYear() == natDays[i][2]) {
> >         return [false, natDays[i][0][1] ];
> >     }
> >   }
> >   return [true, 'desocupa'];
> >
> > }
> >
> > This will add the "desocupa" class to non-nationalDays. If you want the
> > additional class for national days you'd need to change
> >
> > return [false, natDays[i][0][1] ];
> >
> > to
> >
> > return [false, 'desocupa' ];
> >
> > > i can see this comment in datepicker.js and i don't understand ---
> > > beforeShowDay: null, // Function that takes a date and returns an
> > > array with
> > >                       // [0] = true if selectable, false if not, [1] =
> > custom CSS class
> > > name(s) or '',
> > >                       // [2] = cell title (optional), e.g. $.datepicker
> >
> > .noWeekends
> >
> > These specify the return values of the beforeShowDay callback. In your
> case
> > the function is nationalDays. i.e.
> >
> > function nationalDays {
> >   return [ {selectable}, {custom-css}, {custom-cell-title} ];
> >
> > }
> >
> > --
> > Ca-Phun Ung
> > +http://yelotofu.com
> > + hongkong, zce, jquery, php, css, html- Hide quoted text -
> >
> > - Show quoted text -
> >
>


-- 
Ca-Phun Ung
+ http://yelotofu.com
+ hongkong, zce, jquery, php, css, html

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to