Our blazing fast Grid component built with pure JavaScript


Post by sanid »

Hi guys,

I have a problem with the groupSummary Feature inside the Grid.
Initialy Data is displayed correctly and sorted by first Date Column:

Grid datesummary 1.PNG
Grid datesummary 1.PNG (21.46 KiB) Viewed 347 times

but later when the user klicks on the header it doesn't sort the items the same way it was definied in groupSortFn function an result is this:

Grid datesummary 2.PNG
Grid datesummary 2.PNG (22.27 KiB) Viewed 347 times

Correct behaviour is:
Group items by date
Sort Groupes by Date desc

Part of Grid config:

group: {
                field: 'taskDate',
                ascending : false,
                sortable: false,
                groupSortFn : (a, b) =>  {
                    const date1 = getDateFromString(String(a.taskDate));
                    const date2 = getDateFromString(String(b.taskDate));
                    return date1.getTime() < date2.getTime() ? -1 : 1;
                }

Is there a function that controlls header sort click for group summary feature?
If there isn't one how can manual sorting be disabled?

Thanks.

Version 5.0.0
Angular: 11.2.11


Post by marcio »

Hey sanid,

Are you able to share a sample project or sample of data for us to check that group sort?

You can try to use the https://bryntum.com/products/grid/docs/api/Core/data/mixin/StoreSort#event-beforeSort and/or https://bryntum.com/products/grid/docs/api/Core/data/mixin/StoreSort#event-sort listeners to check the header sort click.

Best regards,
Márcio


Post by sanid »

Hi,

Uncaught TypeError: this.grid.store.beforeSort is not a function
Sort method is there but is triggered to late.
My project is allready in production and making sample project could take a while.

How can I disable column sorting for GroupSummary?


Post by tasnim »

Uncaught TypeError: this.grid.store.beforeSort is not a function

the grid might be not defined. You could try setting a breakpoint to debug it.

My project is allready in production and making sample project could take a while.

Could please try if you could reproduce it with one of our demos https://bryntum.com/products/scheduler/examples/ (search group in the search bar)? So it will be really easy for us to investigate.

How can I disable column sorting for GroupSummary?

This is not supported. I've opened a ticket to allow prevent sorting for groups here https://github.com/bryntum/support/issues/6381

All the best,
Tasnim


Post by sanid »

Basicaly its this example:

https://bryntum.com/products/grid/examples/groupsummary/

Clicking on City Column will sort asc / desc, however when custom sorting with groupSortFn is defined its not using that function to sort items, but sorting it as a string.

Thanks for the info and the help


Post by tasnim »

Hi,

Yes, it is sorted as a string
But I'm not sure what you mean by

function to sort items

Could you elaborate a bit?


Post by sanid »

I meant this method beneath , it is only initialy triggered, but not later when user klicks on the header to sort it.

groupSortFn : (a, b) =>  {
                    const date1 = getDateFromString(String(a.taskDate));
                    const date2 = getDateFromString(String(b.taskDate));
                    return date1.getTime() < date2.getTime() ? -1 : 1;
                }

Post by Animal »

beforeSort is indeed not a function. It is the name of an event which you add a listener for.

There is an underlying bug. Clicking the header, replaces the custom group sort function. Here s a ticket: https://github.com/bryntum/support/issues/6386


Post Reply