Skip to content

onProposalRefused

Hears a drag, a resize or a drop let go where the rules refuse it — and why.

Type(proposal: Proposal) => void
Defaultnot set
Live update (update())Yes
Declared inpackages/dom/src/settings.ts

While a person drags, the place shown says whether it may go there; let go where it may not, the event goes back and this receives the proposal: the event, the start and end it would have had, its resourceIds, and violations — constraint (outside business hours, a group, given spans), overlap, allow (your function said no), valid-range, not-editable, each with its eventId. A keyboard grab and an element dropped from the page are said here too (for those, proposal.event is the event the element would have made, not one of the store). Tell the person why (“Outside opening hours”) — the calendar only says it was refused.

import { createCalendar } from '@dzcalendar/dom';
createCalendar(element, {
timeZone: 'Europe/Paris',
editable: true,
businessHours: true,
rules: { constraint: 'businessHours' },
onProposalRefused: (proposal) => {
if (proposal.violations.some((v) => v.code === 'constraint')) alert('Outside opening hours');
},
});

In Angular and Vue it goes in options; in React it is a prop.