Page 1 of 1

[INFO REQ] Programmatically hide an event without removing it from the store/database

Posted: Thu Jan 19, 2023 11:20 am
by lxxrxns

I am able to programmatically/dynamically edit the appearance of an event (i.e. change the color, style, etc) with Javascript. However, I would also like to be able to visually remove an event from the scheduler (without removing it from the database/store).

You might be wondering why (because you'd think a page refresh would just make the event reappear). The reason for this is that my events have a "status", i.e. 1= visible, 2= hidden. When someone removes an event through my javascript (i.e. not with the DELETE button), it changes from status 1 to 2 (hidden). Thus it would be nice if it would also disappear immediately from the scheduler. (When I reload the page, all events with status=2 aren't loaded into the scheduler).

Does an event have a 'hidden' or 'visible' state of some sort, that I can change?

Any tips would be greatly appreciated.


Re: [INFO REQ] Programmatically hide an event without removing it from the store/database

Posted: Thu Jan 19, 2023 11:29 am
by mats

Simply filter the EventStore, as seen here: https://bryntum.com/products/scheduler/examples/filtering/


Re: [INFO REQ] Programmatically hide an event without removing it from the store/database

Posted: Thu Jan 19, 2023 11:42 am
by lxxrxns

And is it possible to filter for an event attribute that is otherwise completely invisible to the user?

My event status (1 or 2) is only stored in the database. I can of course get it into the store by loading it in the session.php, but it isn't something thats editable or anything like that.

Say that I load it into the store, how can I filter out (by default) events that have status=2? (this filter should always be enabled)


Re: [INFO REQ] Programmatically hide an event without removing it from the store/database

Posted: Thu Jan 19, 2023 11:56 am
by mats

You can filter by any field in your data model, or just using a function so - you can filter any way you like :)

eventStore.filter(event => event.status !== 2)