NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Alberto on May 11, 2017, 03:30:30 PM

Title: Datepicker options (beforeShowDays example)
Post by: Alberto on May 11, 2017, 03:30:30 PM
HI,
Is there any way of disable and setting colors to the days in the daypicker?
Thanks
Title: Re: Datepicker options
Post by: Bruce on May 11, 2017, 10:24:15 PM
yes.
see http://api.jqueryui.com/datepicker/
you're looking for the beforeShowDay option.

cheers
Bruce
Title: Re: Datepicker options
Post by: Alberto on May 12, 2017, 02:59:42 AM
Ok, I saw it but
This is a function, can I add it in options?
how do I implement this in NT?
Any example?
Thanks

BTW:
Im using all kind of options, like firtsDay, minDate, maxDate..... etc and they work ok
but...
p_web.SetOption(loc:options,'beforeShowDay','^noWeekends' )  Does not work with or without the caret
Title: Re: Datepicker options
Post by: Bruce on May 12, 2017, 05:59:10 AM
>> This is a function, can I add it in options?

no. You make the function in your javascript code. Then you set that function to the property using SetOption.

But I think you first need to give a lot more information on what it is you are trying to do, and when. Or, to put it another way,
a) write javascript function
b) add javascript funtion to page
c) assign function to calendar.

You're focusing on c) but you need to start with a).

Cheers
Bruce
Title: Re: Datepicker options
Post by: Alberto on May 16, 2017, 09:24:18 AM
Ok, Ive done it ant it works... more or less

Two problems:
PLease see image,

1)the class that the beforeShowDay function returns afects the TD tag ok but the day does not changes.

2)when I choose a date the datepicker appears ok, but when I choose a date, the date becomes blank and if I try to choose another one then another datepicker appears, just as when the new function did not exists and it selects the date ok.

This is my function script

!prueba color y tip
packet.append(p_web.AsciiToUTF(|
  '  <<script><13,10>'&|
  '$( function() {{<13,10>'&|
  '    // An array of dates<13,10>'&|
  '    var eventDates = {{};<13,10>'&|
  '    var eventColor = {{};<13,10>'&|
  '    var eventTip = {{};<13,10>'&|
  '    eventDates[ new Date( ''05/05/2017'' )] = new Date( ''05/05/2017'' );<13,10>'&|
  '    eventColor[ new Date( ''05/05/2017'' )] = new String( '' red'' );<13,10>'&|
  '    eventTip[ new Date( ''05/05/2017'' )] = new String( ''qqqq'' );<13,10>'&|
  '    <13,10>'&|
  '    // datepicker<13,10>'&|
  '    $(''#'&p_web.nocolon('APP:Date')&''').datepicker({{<13,10>'&|
  '        dateFormat: "dd/mm/yyyy",'&|
  '        firstDay: 1,'&|
  '        beforeShowDay: function( date ) {{<13,10>'&|
  '         var highlight = eventDates[date];<13,10>'&|
  '         var color = eventColor[date];<13,10>'&|
  '         var tip = eventTip[date];<13,10>'&|
  '         if( highlight ) {{<13,10>'&|
  '             return [true, color, tip];<13,10>'&|
  '         } else {{<13,10>'&|
  '             return [false, '''', ''''];<13,10>'&|
  '         }<13,10>'&|
  '        }<13,10>'&|
  '    });<13,10>'&|
  '});<13,10>'&|
  '<</script><13,10>'&|
  '',net:OnlyIfUTF,net:StoreAsAscii))

Title: Re: Datepicker options
Post by: Bruce on May 16, 2017, 10:46:10 PM
I think perhaps you need to post an example app.

cheers
Bruce
Title: Re: Datepicker options
Post by: Alberto on May 17, 2017, 03:28:25 AM
May be the problem is I dont know how to do your c) point
c) Add the function to calendar

Attached goes the example app
-Compile it
-Goto Home/FullCalendar EXample
-Click on the 17/5 (bruce) PLease Test event
-Click on the datepicker lookup button
-Will see only day 5 enable
-Select it
-See theres no date selected
-Click AGAIN in the datepicker lookup button
-The original datepickr without the new function is popup

Thanks
Title: Re: Datepicker options (beforeShowDays example)
Post by: Alberto on May 29, 2017, 04:40:17 AM
Have you had time to look at it?
Thanks