Hello team,
I need to filter events via a custom field I've added to the event model. That field is a booelan, so I'd like to put a checkbox in the sidebar to filter events where that field equals true.
I understand I should leverage on the eventStore to do that, but it seems the configuration object doesn't have access to the calendar instance. Is it the right approach, or are there other ways?
This is a sample of what I'm trying to do:
<script setup>
import { reactive } from 'vue';
import { EventModel } from "@bryntum/calendar";
import type { BryntumCalendarProps } from "@bryntum/calendar-vue-3";
class AppEventModel extends EventModel {
declare title: string;
declare isPublic: boolean;
static override get fields() {
return [
{ name: "name", dataSource: "title" },
{ name: "isPublic", type: "boolean" },
];
}
}
const calendarConfiguration: BryntumCalendarProps = {
crudManager: {
transport: {
load: {
url: "./data/data.json",
},
},
eventStore: {
modelClass: AppEventModel,
},
autoLoad: true,
},
sidebar: {
items: {
showPublished : {
weight : 200,
type : 'slidetoggle',
label : 'Test filter',
onChange : (value) => {
console.log('toggle value', value.checked)
console.log('main obj', calendar.eventStore); // <-- calendar is undefined!
},
},
}
}
}
const calendarConfig = reactive(calendarConfiguration);
</script>
<template>
<div class="calendar-wrapper">
<bryntum-calendar
v-bind="calendarConfig"
/>
</div>
</template>
Can you help me?