Premium support for our pure JavaScript UI components


Post by Phil234234234234 »

Hello

With the Calendar, we've noticed a issue where if you add a new resource to the resource store, and then add a new event to the event store - the event will appear, even though the filter bar on the left which shows the matching resource is unticked. Essentially the filter bar says the event shouldn't appear, but it does.

This is replicable if you go to the demo https://www.bryntum.com/examples/calendar/basic/ and you add

tbar : {
        items : {
            highlight : {
                type                 : 'textfield',
                keyStrokeChangeDelay : 2000,
                onChange({ value }) {
                    calendar.resourceStore.add({ id: value, name: value });
                }
            }
        }
    }

And then type something into the text bar to add a new resource. Then create a new event using that resource. Once you have created this new event, it should appear on the Calendar - even though the associated resource is unticked.

Picture of the scenario attached below. Specifically for the resource 'resource' and the event 'resource event'.

Could someone take a look at this please?

Attachments
Screenshot 2021-09-06 at 10.39.22.png
Screenshot 2021-09-06 at 10.39.22.png (39.56 KiB) Viewed 654 times

Post by alex.l »

Thanks for the report, here is a ticket: https://github.com/bryntum/support/issues/3375

All the best,
Alex


Post by mats »

This is by design, if you want the store to re-filter itself after add:

Try setting: https://bryntum.com/docs/scheduler/#Core/data/mixin/StoreFilter#config-reapplyFilterOnAdd


Post by Phil234234234234 »

Thank you for the information and we've applied this setting and now the UI renders consistently (ie the event does not show because the resource is not ticked). We would want for newly added events to show without the user having to unfilter the new resource. On initial load, all resources are ticked by default - how can we achieve the same if resources are added later?


Post by alex.l »

On initial load, all resources are ticked by default - how can we achieve the same if resources are added later?

There is no property to manage it. You could subscribe on add event https://bryntum.com/docs/gantt/#Gantt/data/ResourceStore#event-add
and select it manually.

calendar.resourceStore.on('add', ({ records }) => {
    const { resourceFilter } = calendar.sidebar.widgetMap;
    resourceFilter.selected.add(records);
});

All the best,
Alex


Post by Phil234234234234 »

That worked perfectly - thank you very much!


Post Reply