Page 1 of 1

Daterange Picker (from/until)

Posted: 2019-12-05 07:19
by jsetzer
PRO-Tipp for you AppGineers out there:

If you need inputs for a period (from date - to date), just create two datetime-fields in AppGini, then call the following code in hooks/TABLENAME-dv.js:

Code

Code: Select all

new AppGiniFields(["valid_from", "valid_to"]).toDatepicker("Valid from/to");
Output
chrome_lX4BkSGbxE.png
chrome_lX4BkSGbxE.png (1.93 KiB) Viewed 10975 times

Check this out. Both inputs will be linked which means for example after you have selected from-date, the to-date-picker is limited to future dates and vice versa.

Please note
  • Datatype has to be Datetime
  • Pass an array of exactly 2 (!) fieldnames to the constructor of AppGiniFields
  • Pass a string to the toDatepicker() function. This will be the new label.
  • Both pickers will be aligned inline with 50% width
  • Your project's date-format should be applied automatically
Documentation

https://appgini.bizzworxx.de/products/j ... ge-picker/

Hope you like it!

Best,
Jan

Re: Daterange Picker (from/until)

Posted: 2020-03-19 11:36
by chrisagon
Hello,
I try to insert this AppGiniFields in a new AppGiniLayout but it doesn't seems to work :

Code: Select all

var date_periode = new AppGiniFields(["date_debut", "date_fin"]).toDatepicker("Période :");
var row_1 = new AppGiniLayout([12])
    .add(1, ["#Mission", "site_mission", "periode", date_periode , "-"])
    .sizeLabels(2)
    ;
I have the error :

Code: Select all

AppGiniHelper.min.js:6 Uncaught TypeError: _0x26630e[bx_0x3f2d(...)] is not a function
    at AppGiniHelper.min.js:6
    at Array.forEach (<anonymous>)
    at _0x34db9f._0x1cbc4c.add (AppGiniHelper.min.js:6)
    at missions-dv.js:15

Re: Daterange Picker (from/until)

Posted: 2020-03-26 04:42
by jsetzer
I'm not sure, can you please try to first move the two fields into the layout and afterwards call the toDatepicker function.

Re: Daterange Picker (from/until)

Posted: 2020-03-26 11:17
by chrisagon
It seems so easy when it works :-)
Thank you.