Page 1 of 1

Calendar ResourceStore sorting not working

Posted: Thu Nov 25, 2021 2:58 pm
by philipp.froebel

Hi Bryntum Team,

i dry to sort a calendar ResourceStore unfortunately without success :-(

What i do is this

const project = new bryntum.calendar.ProjectModel({
                startDate: new Date().toISOString(),
                resourceStore: {
                    sorters: [{ field: "name", ascending: false }],
                    data: [
                        {
                            name: "a",
                            eventColor: "#ff0000"
                        },
                        {
                            name: "b",
                            eventColor: "#ccc"
                        }
                    ]
                }
            });

new bryntum.calendar.Calendar({
                minHeight: 525,
                height: '100%',
                resourceStore: project.resourceStore,

            // Start life looking at this date
            date: new Date(),

            dateFormat: 'DD.MM.YYYY',
            

            // This element becomes the Calendar's encapsulating element
            adopt: 'frn-calendar-container',

        });

The order of the resources is always a, b whether the sorter is { field: "name", ascending: false } or { field: "name", ascending: true }.

Please give me a help for sorting resources.

Tested with version 4.0.8 and 4.3.2

Thanks
Philipp


Re: Calendar ResourceStore sorting not working

Posted: Thu Nov 25, 2021 3:26 pm
by Animal

The creation of the ResourceStore is obeying:

Screenshot 2021-11-25 at 14.21.13.png
Screenshot 2021-11-25 at 14.21.13.png (68.01 KiB) Viewed 470 times

But the ResourceFilter in the Sidebar uses a chained store (basically a slave store, so that it does not affect the main resourceStore and the main resourceStore does not affect it)

It is configured to sort itself in ascending order.

You can configure it:

sidebar : {
    items : {
        resourceFilter : {
            store : {
                sorters : [{
                    ascending : false
                }]
            }
        }
    }
}

Re: Calendar ResourceStore sorting not working

Posted: Thu Nov 25, 2021 4:22 pm
by philipp.froebel

Hi Animal,

the sorting works now but only if configured the sorter on the resourceStore and also on sidebars chained store.

Thanks
Philipp


Re: Calendar ResourceStore sorting not working

Posted: Thu Nov 25, 2021 4:32 pm
by Animal

They are two separate stores.

If you want the Project's ResourceStore to begin sorted, you have to tell it.

If you want to override the default configuration which the resourceFilter applies to its slave store, you have to tell it.


Re: Calendar ResourceStore sorting not working

Posted: Thu Nov 25, 2021 4:52 pm
by philipp.froebel

Ok now it works with configured only the resourceFilter store.

thanks a lot
philipp