The onTimeRangeSelect event handler fires when the selection changes, before the default action configured by timeRangeSelectedHandling is performed.
Declaration
DayPilot.Navigator.onTimeRangeSelect(args)Parameters
args.day(DayPilot.Date) - day that was clicked, if applicableargs.start(DayPilot.Date) - selection startargs.end(DayPilot.Date) - selection endargs.days(number) - selected day countargs.preventDefault()- prevents the default action
Notes
Use args.preventDefault() to handle the selection change without running the default action selected using timeRangeSelectedHandling.
Examples
JavaScript
const dp = new DayPilot.Navigator("dp", {
onTimeRangeSelect: (args) => {
if (args.days > 7) {
args.preventDefault();
}
},
// ...
});
dp.init();Angular
<daypilot-navigator [config]="config"></daypilot-navigator>config: DayPilot.NavigatorConfig = {
onTimeRangeSelect: (args) => {
if (args.days > 7) {
args.preventDefault();
}
},
// ...
};React
<DayPilotNavigator
onTimeRangeSelect={onTimeRangeSelect}
{/* ... */}
/>const onTimeRangeSelect = (args) => {
if (args.days > 7) {
args.preventDefault();
}
};Vue
<DayPilotNavigator
@timeRangeSelect="onTimeRangeSelect"
<!-- ... -->
/>const onTimeRangeSelect = (args) => {
if (args.days > 7) {
args.preventDefault();
}
};See Also
DayPilot.Navigator.timeRangeSelectedHandling
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot