NetTalk Central

Author Topic: Datepicker options (beforeShowDays example)  (Read 4936 times)

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Datepicker options (beforeShowDays example)
« 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
« Last Edit: May 18, 2017, 08:46:54 AM by michelis »
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Datepicker options
« Reply #1 on: May 11, 2017, 10:24:15 PM »
yes.
see http://api.jqueryui.com/datepicker/
you're looking for the beforeShowDay option.

cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Datepicker options
« Reply #2 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
« Last Edit: May 12, 2017, 04:42:16 AM by michelis »
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Datepicker options
« Reply #3 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

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Datepicker options
« Reply #4 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))

-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Datepicker options
« Reply #5 on: May 16, 2017, 10:46:10 PM »
I think perhaps you need to post an example app.

cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Datepicker options
« Reply #6 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
« Last Edit: May 17, 2017, 04:30:15 AM by michelis »
-----------
Regards
Alberto

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Datepicker options (beforeShowDays example)
« Reply #7 on: May 29, 2017, 04:40:17 AM »
Have you had time to look at it?
Thanks
-----------
Regards
Alberto