NetTalk Central

Author Topic: Global setting of DatePicker Options  (Read 2298 times)

GordonF

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
Global setting of DatePicker Options
« on: September 14, 2021, 07:18:55 AM »
Is there a way to set DatePicker options globally so the default behaviour can be configured, for instance allowing year selection and a default year range, I can do this locally on each date field by setting the options but it would be nicer in my case to set defaults at a higher level and then override on the few occasions it is required.

Gordon


Alberto

  • Hero Member
  • *****
  • Posts: 1844
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Global setting of DatePicker Options
« Reply #1 on: September 14, 2021, 08:17:37 AM »
I do it in the ProcessLink embed.
If you are usging NT 12.25 becarefull that the calendar does not show the actual field date value.
This was reported to Bruce.
Regards
« Last Edit: September 14, 2021, 08:19:41 AM by michelis »
-----------
Regards
Alberto

GordonF

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
Re: Global setting of DatePicker Options
« Reply #2 on: September 15, 2021, 12:24:24 AM »
Hi Michelis,

Thank you for your reply, forgive my ignorance but what procedure is the processlink embed actually in and what does the code look like to set the datepicker global options.

Any help would be appreciated.

Regards
Gordon

Alberto

  • Hero Member
  • *****
  • Posts: 1844
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Global setting of DatePicker Options
« Reply #3 on: September 15, 2021, 03:15:42 AM »
Hi Gordon, no problem, ProcessLnk is a method inside WebHandler, simple go to Embed and found it, then you can embed someting like this:
Code: [Select]
Self.site.DateOptions = 'monthNames: [''Enero'', ''Febrero'', ''Marzo'', ''Abril'', ''Mayo'', ''Junio'', ''Julio'', ''Agosto'', ''Setiembre'', ''Octubre'', ''Noviembre'', ''Diciembre'']'&|
                        ',monthNamesShort: [''Ene'', ''Feb'', ''Mar'', ''Abr'', ''May'', ''Jun'', ''Jul'', ''Ago'', ''Set'', ''Oct'', ''Nov'', ''Dic'']'&|
                        ',dayNamesMin: [''Do'', ''Lu'', ''Ma'', ''Mi'', ''Ju'', ''Vi'', ''Sa'']'&|
                        ',dayNamesShort: [''Dom'', ''Lun'', ''Mar'', ''Mie'', ''Jue'', ''Vie'', ''Sab'']'&|
                        ',closeText: ''Cancelar'''&|
                        ',currentText: ''Hoy'''&|
                        ',dateFormat: ''dd/mm/yy'''&|
                        ',nextText: ''Pr?ximo'''&|
                        ',prevText: ''Anterior'''&|
                        ',dayNames:[''Domingo'', ''Lunes'', ''Martes'', ''Miercoles'', ''Jueves'', ''Viernes'', ''Sabado'']'&|
                        ',numberOfMonths: 3'&|
                        ',firstDay: 7'&|
                        ',showWeek: true'&|
',noWeekends: true'&|
',maxDate: ''+3M'''&|
',duration: ''fast'''&|
',weekHeader: ''S'''&|
',showCurrentAtPos: 1'&|
''
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11158
    • View Profile
Re: Global setting of DatePicker Options
« Reply #4 on: September 15, 2021, 04:49:31 AM »
Hi Gordon,

for the possible options to the date picker (ie the options that Alberto is using below) see
https://api.jqueryui.com/datepicker/

There are a LOT of possible options, so you can do whatever you like.

Alberto: Unfortunately I have not been able to duplicate the issue that you reported. It may be related to one of the options you are using. From your report it is not clear if the error only occurs with your global options setting? or if it happens without the options?

Cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1844
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Global setting of DatePicker Options
« Reply #5 on: September 15, 2021, 05:39:39 AM »
Bruce, just compile the web1 nt example in NT11 and NT12 without any change.

When you get the calendar in NT11, it has the date selected OK and when you press Today it is selected OK and in another colour.

When you get the calendar in NT12, it has NOT the date selected, and when you press Today it is selected OK but in the selected colour.

Please see pics
-----------
Regards
Alberto

GordonF

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
Re: Global setting of DatePicker Options
« Reply #6 on: September 15, 2021, 11:45:41 PM »
Thank you to both of you for your help I'm very grateful.

Gordon

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11158
    • View Profile
Re: Global setting of DatePicker Options
« Reply #7 on: September 16, 2021, 12:28:41 AM »
thanks Alberto - fixed for 12.26

GordonF

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
Re: Global setting of DatePicker Options
« Reply #8 on: September 16, 2021, 05:46:49 AM »
Hi Alberto, when I include the option

',showCurrentAtPos: 1'&|

The previous button no longer works, have you seen the same  thing? If I remove it then all is well and position 1 appears to be the default behaviour.

Gordon

Alberto

  • Hero Member
  • *****
  • Posts: 1844
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Global setting of DatePicker Options
« Reply #9 on: September 18, 2021, 08:16:38 AM »
Hi Gordon, as Bruce said...

for the possible options to the date picker (ie the options that Alberto is using below) see
https://api.jqueryui.com/datepicker/

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