Page 2 of 2

Re: [REACT] Implementing multi-level filtering, on just the event store

Posted: Mon Aug 12, 2024 6:19 pm
by marcio

Hey,

There is no method to specifically sort widgets, but you can use https://bryntum.com/products/calendar/docs/api/Core/widget/Widget#config-weight to configure the order of the widgets in a Container.


Re: [REACT] Implementing multi-level filtering, on just the event store

Posted: Tue Aug 13, 2024 8:00 am
by Animal

You won't really sort anything.

You will synthesize a config object for the widget which you would like to see in the sidebar to make it looks like the example.

Then just use

myCalendar.sidebar.add(theConfigObject);

The config object must contain a type to indicate the type you are wanting it to create when it promotes the config to a real widget.

It must have a weight for it to sit among the existing widgets. These are all documented in the Calendar API docs.

And it should have a ref name which will be added to the Calendar's widgetMap so you can always grab that widget and use its API.

If this operation happens multiple times, don't forget to do

    const
        { sidebar } = myCalendar,
        oldWidget = myCalendarwidgetMap.<theRefYouAreUsing>;

    sidebar.remove(oldWidget);
    oldWidget.destroy;

To remove and destroy the old one. You don't want instances to leak.


Re: [REACT] Implementing multi-level filtering, on just the event store

Posted: Tue Aug 13, 2024 10:11 pm
by ccarleykxs

Final question about implementing this :)

When applying a filter to the eventStore, is it possible for the collection to treat the conditions as filter1 || filter2?

I.e, when filtering on the event store, on lets say the "fruits" variable, I want to apply two seperate filters, one for Apples and one for Bananas, and when both are enabled, events with the "fruits" variable Apples or Bananas should show.


Re: [REACT] Implementing multi-level filtering, on just the event store

Posted: Thu Aug 15, 2024 8:32 am
by alex.l

Hi,

Sure, you can use any custom method you want within https://bryntum.com/products/calendar/docs/api/Core/util/CollectionFilter#property-filterBy

eventStore.filter({
                id       : 'fruits',
                filterBy : event =>
                    return IsBananaSelected ? event.type == 'banana' : event.type == 'apple';
            });

Re: [REACT] Implementing multi-level filtering, on just the event store

Posted: Thu Aug 15, 2024 4:13 pm
by Animal

All filters added to a store are ANDed

If you need OR, you will implement that inside your own filterBy function