Our powerful JS Calendar component


Post by dcruz1990 »

Is there a way to make an event unselectable?


Post by marcio »

Hey dcruz1990,

Yes, there is the https://bryntum.com/products/calendar/docs/api/Calendar/view/mixin/EventSelection#config-isEventSelectable configuration, you can check in the documentation for more info, like the example

isEventSelectable(event) {
        return event.startDate >= Date.now();
    }

Best regards,
Márcio


Post by dcruz1990 »

Thanks for the quick response @marcio, but i can't get it done, can i pass it to the view config?.

Edit: also, it gets confusing on the documentation examples, because it says new Scheduler(...) and i need it for the Calendar.


Post by Animal »

It's a bug that this is not called. https://github.com/bryntum/support/issues/6177

the EventSelection mixin that Calendar uses extends the Scheduler's one. We reuse code for common purposes to keep APIs and the user experience the same as far as possible.

The new Scheduler() is just for example. It could be new Calendar() (But doesn't work right now)


Post by Animal »

You should be able to add a listener for the beforeeventselectionchange event and return false if the event must not be selected.


Post by dcruz1990 »

Thanks @Animal for answering, found out that EventSelection mixin was removed from the docs. When using beforeEventSelectionChange, i get access to something like this:

Image

I don't know if this is part of the bug. Im using the listener this way:
Image, also tried to put another function and behave the same way, i still can select events.

However, if i put a debugger inside the function, it works fine and event doesn't get selected, i mean, tooltip isn't rendered.


Post by Animal »

The listener definitely works when added to the Calendar object.

Clicked on the event there which shows the tooltip, and no events are selected.

Can't really see what you're doing there.

Screenshot 2023-02-15 at 16.44.40.png
Screenshot 2023-02-15 at 16.44.40.png (196.87 KiB) Viewed 277 times

Post by dcruz1990 »

I just want to prevent the event gets selected, and don't render the tooltip as well. Say that i have an event of type X, i want to set it to readOnly and unselectable. Remember that i'm using Vue2.


Post by Animal »

You don't want the event tooltip? Just disable the feature.

I don't understand Vue or any of these frameworks.


Post Reply