@@ -25,15 +25,20 @@ Settings applies globally to all widgets used in your site.
2525 }
2626
2727
28- You can set date and event hook options using JavaScript.
28+ JavaScript events and some options can only be set using JavaScript. Starting from v5.0, you can set events and options
29+ globally for all widgets like below in your html template inside a ``<script> `` tag.
2930
3031.. code :: javascript
3132
3233 window .dbdpOptions = {
3334 widgetParent: jQuery (" #myWidgetParent" ),
3435 }
3536 window .dbdpEvents = {
37+ " dp.change " : e => console .log (" Date selected:" , e .date , e .oldDate ),
3638 " dp.show " : e => console .log (" Calendar opened" ),
39+ " dp.hide " : e => console .log (" Calendar closed" , e .date ),
40+ " dp.error " : e => console .log (" Invalid date input" , e .date , e .oldDate ),
41+ " dp.update " : e => console .log (" viewDate changed" , e .viewDate , e .change ),
3742 }
3843
3944
@@ -63,15 +68,21 @@ to widget instance.
6368 },
6469 ))
6570
66- Similarly set date and event hook options using JavaScript.
71+ JavaScript events and some options can only be set using JavaScript. Starting from v5.0, you can set events and options
72+ for a specific widget for a widget with field name ``deadline_date `` like below in your html template inside a ``<script> `` tag.
6773
6874.. code :: javascript
6975
76+ // Applies to a widget with field name `deadline_date`
7077 window .dbdpOptions_deadline_date = {
7178 widgetParent: jQuery (" #myWidgetParent" ),
7279 }
7380 window .dbdpEvents_deadline_date = {
74- " dp.show " : e => console .log (" Calendar opened" ),
81+ " dp.change " : (e ) => console .log (" Deadline changed:" , e .date ? .format (' YYYY-MM-DD' )),
82+ " dp.show " : e => console .log (" Deadline picker opened" ),
83+ " dp.hide " : e => console .log (" Deadline picker closed" , e .date ),
84+ " dp.error " : e => console .log (" Invalid date input" , e .date , e .oldDate ),
85+ " dp.update " : e => console .log (" viewDate changed" , e .viewDate , e .change ),
7586 }
7687
7788
0 commit comments