Our powerful JS Calendar component


Post 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.

Best regards,
Márcio


Post 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.


Post 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.


Post 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';
            });

All the best,
Alex


Post by Animal »

All filters added to a store are ANDed

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


Post Reply