You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -10,155 +10,211 @@ Datepicker (N.datepicker) displays a calendar popup for selecting a date or mont
10
10
- See the [Form], [List], and [Grid] menus' [Declarative Options] tab and the [Formatter] menu's [Format Rule List] tab for rules like ["date", 4|6|8|10|12|14, "month"|"date"].
11
11
- For an explanation of declarative options, see the **Declarative Options** section in the [API Documentation Guide].
12
12
13
+
## Table of Contents
14
+
15
+
- Constructor
16
+
- Default Options
17
+
- Methods
18
+
- Events
19
+
- Examples
20
+
13
21
## Constructor
14
22
15
23
-`N.datepicker(context, opts)`
16
24
- context: jQuery object or selector string (input element to apply Datepicker)
17
25
- opts: options object
18
26
- Returns: N.datepicker instance
27
+
19
28
-`N(obj).datepicker(opts)`
20
29
- jQuery plugin method to create an N.datepicker instance
21
30
22
31
## Default Options
23
32
24
-
- context: jQuery object or selector string (Required)
33
+
-**context**: jQuery object or selector string (Required)
-If set, holidays are displayed in the Datepicker.
61
+
-**onSelect**: function (default: null)
62
+
- Event handler called when a date or month (if monthonly is true) is selected.
63
+
-**onBeforeShow**: function (default: null)
64
+
- Event handler before the datepicker is shown.
65
+
-**onShow**: function (default: null)
66
+
- Event handler after the datepicker is shown.
67
+
-**onBeforeHide**: function (default: null)
68
+
- Event handler before the datepicker is hidden.
69
+
-**onHide**: function (default: null)
70
+
- Event handler after the datepicker is hidden.
71
+
-**onChangeYear**: function (default: null)
72
+
- Event handler when the year is changed.
73
+
-**onChangeMonth**: function (default: null)
74
+
- Event handler when the month is changed.
75
+
76
+
### Example: Setting the holiday option
68
77
69
78
The holiday option can be set as follows:
70
79
71
80
```javascript
72
81
{
73
-
repeat: {
74
-
"0619":"Holiday1",
75
-
"0620":"Holiday3",
76
-
"0621": ["Holiday6", "Holiday7"],
77
-
"0622": ["Holiday9", "Holiday10"]
78
-
},
79
-
once: {
80
-
"20200619":"Holiday2",
81
-
"20200620": ["Holiday4", "Holiday5"],
82
-
"20200621":"Holiday8",
83
-
"20200622": ["Holiday11", "Holiday12"]
84
-
}
82
+
repeat: {
83
+
"0619":"Holiday1",
84
+
"0620":"Holiday3",
85
+
"0621": ["Holiday6", "Holiday7"],
86
+
"0622": ["Holiday9", "Holiday10"]
87
+
},
88
+
once: {
89
+
"20200619":"Holiday2",
90
+
"20200620": ["Holiday4", "Holiday5"],
91
+
"20200621":"Holiday8",
92
+
"20200622": ["Holiday11", "Holiday12"]
93
+
}
85
94
}
86
95
```
87
96
88
-
-The repeat object is for holidays that repeat every year (exclude the year).
89
-
-The once object is for holidays that do not repeat every year (use YYYYMMDD format).
97
+
-Use the repeat object for holidays that repeat every year (exclude the year).
98
+
-Use the once object for holidays that do not repeat every year (use the full date: year, month, day).
90
99
- If there are multiple holidays on the same date, use an array of names.
91
-
- If you set the N.context.attr("ui").datepicker.holiday property in Config (natural.config.js), it applies to all Datepickers.
100
+
101
+
If you set the N.context.attr("ui").datepicker.holiday property in [Config(natural.config.js)](https://bbalganjjm.github.io/natural_js/?page=html/naturaljs/refr/refr0102.html), it will apply to all Datepickers.
Elements marked as holidays get the class "Datepicker_holiday__".
116
+
Elements marked as holidays will have the class "Datepicker_holiday__".
107
117
108
118
## Events
109
119
110
120
Datepicker defines the following events for the input element specified as context. Event handlers can be set as options during initialization or attached separately. If an event with the same name is already bound, the handler specified during initialization takes precedence.
111
121
112
-
- onSelect: Executed when a date or month is selected
113
-
- onBeforeShow: Executed before the Datepicker is shown
114
-
- onShow: Executed after the Datepicker is shown
115
-
- onBeforeHide: Executed before the Datepicker is hidden
0 commit comments