Hi everyone,
I'm using Calendar and I trying to pass an updated Resources props by clicking a custom button on tbar.
My scenario.
I have List and DayResourceView.
In both views the Events prop is the same, but I need to change the Resources props.
In the sidebar I need to see different Resources (checkbox filters) based on list view or DayResourceView.
In the lateral sidebar you can see the updated Resources, but the reference model for seeing the selected ones seems to remain referred to the previous one.
Some code here.
// TBar config
tbar: {
items: {
customButton1 : {
type: "button",
text: "Test Attraction 3",
weight: 650,
onClick() {
EventsManager.emitSelectAttraction(3); // the emit is working
}
},
customButton2 : {
type: "button",
text: "Test Attraction 2",
weight: 650,
onClick() {
EventsManager.emitSelectAttraction(2); // the emit is working
}
}
}
},
// BryntumCalendar init
<BryntumCalendar
ref="calendar"
:events="events"
:resources="resourcesBryntum"
v-bind="calendarConfig"
:on-active-item-change="({activeItem}) => setCurrentCalendarMode(activeItem.modeName)"
/>
const setCurrentBryntumResources = (attractionId = 1) => {
if (currentCalendarMode.value == "list")
resourcesBryntum.value = toRaw(attractions.value);
else if (currentCalendarMode.value == "dayresource") {
const tmpResources = toRaw(resources.value);
const filteredResourcesByAttraction = tmpResources.filter(resource => {
return resource.attractionId === attractionId;
});
resourcesBryntum.value = filteredResourcesByAttraction;
}
};
How can I update correctly the Resources elements?