onEventOpen
Hears “Open” chosen in the context menu of an event.
| Type | (instance: EventInstance) => void |
|---|---|
| Default | not set |
Live update (update()) | Yes |
| Declared in | packages/dom/src/settings.ts |
What it does
Section titled “What it does”With it, an event’s context menu offers “Open”; chosen, you receive the
event’s instance — show your details or your editor. Without onEventClick,
Enter or Space on a focused event calls this one too, and so do a click on
an event in the list views and a view of your own calling its open (in the
grids and the timeline a click stays onEventClick’s). The Pro’s editor
(@dzcalendar/pro/editor) is one way to answer it.
Example
Section titled “Example”import { createCalendar } from '@dzcalendar/dom';
createCalendar(element, { timeZone: 'Europe/Paris', onEventOpen: (instance) => location.assign(`/appointments/${instance.event.id}`),});import { Component } from '@angular/core';import type { EventInstance } from '@dzcalendar/core';import { DZ_CALENDAR } from '@dzcalendar/angular';
@Component({ selector: 'app-agenda', imports: [DZ_CALENDAR], template: `<dz-calendar timeZone="Europe/Paris" (eventOpen)="open($event)" />`,})export class Agenda { open(instance: EventInstance): void { console.log('open', instance.event.id); }}import { DzCalendar } from '@dzcalendar/react';
export function Agenda() { return <DzCalendar timeZone="Europe/Paris" onEventOpen={(instance) => console.log('open', instance.event.id)} />;}<script setup lang="ts">import type { EventInstance } from '@dzcalendar/core';import { DzCalendar } from '@dzcalendar/vue';
const open = (instance: EventInstance) => console.log('open', instance.event.id);</script>
<template> <DzCalendar time-zone="Europe/Paris" @event-open="open" /></template>In the frameworks it is an output: Angular’s (eventOpen), React’s onEventOpen, Vue’s @event-open.
See also
Section titled “See also”onEventClick— a plain click on an event.contextMenu— the menu’s entries.- The event editor (Pro).