Page 1 of 1
Datepicker on multiple fields
Posted: 2021-01-26 14:20
by eagle
I have trouble using the datepicker setting on several fiels.
Should this work?
Code: Select all
var dv = new AppGiniDetailView();
dv.compact();
new AppGiniField( "date_a" ).toDatepicker();
new AppGiniField( "date_b" ).toDatepicker();
new AppGiniField( "date_c" ).toDatepicker();
Re: Datepicker on multiple fields
Posted: 2021-01-26 14:25
by jsetzer
Did you model those three fields as DateTime, (not Date)?
Re: Datepicker on multiple fields
Posted: 2021-01-26 14:30
by eagle
jsetzer wrote: ↑2021-01-26 14:25
Did you model those three fields as DateTime, (not Date)?
Yes, all three are DateTime in AppGini and I just checked that they are also datatime in the database.
Only the first field works as intended.
Re: Datepicker on multiple fields
Posted: 2021-01-26 14:32
by jsetzer
I've just checked and it works for me:

- AppGini_bCqo6wcgfq.png (71.88 KiB) Viewed 4828 times
Code: Select all
// file: hooks/TABLENAME-dv.js
var dv = AppGiniHelper.dv;
dv.getField("datetime").toDatePicker();

- chrome_KiyCURGS5p.png (17.57 KiB) Viewed 4828 times
Browser cache problem?
Re: Datepicker on multiple fields
Posted: 2021-01-26 14:36
by eagle
> Browser cache problem?
Yes I think it was. While you wrote this last message I tested once more and now it works. Sorry for the false alarm.
Works great now. Thanks!
Eagle
Re: Datepicker on multiple fields
Posted: 2021-01-26 14:36
by jsetzer
By the way:
Please always use the singleton initialization for dv now.
The old initialization is deprecated since October last year due to problems when developers initialized the same object multiple times at different places, for example in header-extras.php AND again in -dv.js
Re: Datepicker on multiple fields
Posted: 2021-01-26 14:37
by jsetzer
No prob. I'm glad it works for you now! Always remember to clear browser cache after changing js or css, especially if there is something does not work as expected.
See troubleshooting guide here:
https://appgini.bizzworxx.de/support/troubleshooting/
Re: Datepicker on multiple fields
Posted: 2021-01-26 15:01
by eagle
Thanks again!
Will use the singleton initialization for dv from now on
Eagle.